The TEXTMINE Procedure
Example 24.2 Parsing with Stemming
This example uses the data table that is generated in Example 24.1. The following statements run PROC TEXTMINE to parse the documents. Because the NOSTEMMING option is not specified in the PARSE statement, words are stemmed (the default).
/* create data table */
data mycas.CarNominations;
infile datalines delimiter='|' missover;
length text $70 ;
input text$ i;
datalines;
The Ford Taurus is the World Car of the Year. |1
Hyundai won the award last year. |2
Toyota sold the Toyota Tacoma in bright green. |3
The Ford Taurus is sold in all colors except for lime green. |4
The Honda Insight was World Car of the Year in 2008. |5
;
run;
proc textmine data=mycas.CarNominations;
doc_id i;
var text;
parse
notagging nonoungroups
termwgt = none
cellwgt = none
reducef = 1
entities = none
outparent= mycas.outparent
outterms = mycas.outterms
outchild = mycas.outchild
outconfig= mycas.outconfig
;
run;
data outterms; set mycas.outterms; run;
proc print data = outterms; run;
Output 24.2.1 shows the content of the mycas.outterms data table. In this example, words are stemmed. You can see that the term "sold" now stems to the parent term "sell." Also, the mycas.outparent data table and the mycas.outchild data table are different. The parent term "sell" shows up in mycas.outparent (key=11), but not the child term "sold" (key=27). Only "sold" appears in the mycas.outchild data table, and "sell" does not appear.
Output 24.2.1: The mycas.outterms Data Table with Stemming
| Obs | Term | Role | Attribute | Freq | numdocs | _keep | Key | Parent | Parent_id | _ispar | Weight |
|---|---|---|---|---|---|---|---|---|---|---|---|
| 1 | all | Alpha | 1 | 1 | Y | 1 | . | 1 | 1 | ||
| 2 | win | Alpha | 1 | 1 | Y | 2 | . | 2 | + | 1 | |
| 3 | toyota | Alpha | 2 | 1 | Y | 3 | . | 3 | 1 | ||
| 4 | ford | Alpha | 2 | 2 | Y | 4 | . | 4 | 1 | ||
| 5 | tacoma | Alpha | 1 | 1 | Y | 5 | . | 5 | 1 | ||
| 6 | year | Alpha | 3 | 3 | Y | 6 | . | 6 | 1 | ||
| 7 | taurus | Alpha | 2 | 2 | Y | 7 | . | 7 | 1 | ||
| 8 | won | Alpha | 1 | 1 | Y | 26 | 2 | 2 | . | 1 | |
| 9 | honda | Alpha | 1 | 1 | Y | 8 | . | 8 | 1 | ||
| 10 | bright | Alpha | 1 | 1 | Y | 9 | . | 9 | 1 | ||
| 11 | be | Alpha | 3 | 3 | Y | 10 | . | 10 | + | 1 | |
| 12 | sold | Alpha | 2 | 2 | Y | 27 | 11 | 11 | . | 1 | |
| 13 | sell | Alpha | 2 | 2 | Y | 11 | . | 11 | + | 1 | |
| 14 | colors | Alpha | 1 | 1 | Y | 28 | 23 | 23 | . | 1 | |
| 15 | lime | Alpha | 1 | 1 | Y | 12 | . | 12 | 1 | ||
| 16 | except | Alpha | 1 | 1 | Y | 13 | . | 13 | 1 | ||
| 17 | hyundai | Alpha | 1 | 1 | Y | 14 | . | 14 | 1 | ||
| 18 | in | Alpha | 3 | 3 | Y | 15 | . | 15 | 1 | ||
| 19 | is | Alpha | 2 | 2 | Y | 29 | 10 | 10 | . | 1 | |
| 20 | for | Alpha | 1 | 1 | Y | 16 | . | 16 | 1 | ||
| 21 | world | Alpha | 2 | 2 | Y | 17 | . | 17 | 1 | ||
| 22 | green | Alpha | 2 | 2 | Y | 18 | . | 18 | 1 | ||
| 23 | the | Alpha | 8 | 5 | Y | 19 | . | 19 | 1 | ||
| 24 | of | Alpha | 2 | 2 | Y | 20 | . | 20 | 1 | ||
| 25 | award | Alpha | 1 | 1 | Y | 21 | . | 21 | 1 | ||
| 26 | was | Alpha | 1 | 1 | Y | 30 | 10 | 10 | . | 1 | |
| 27 | car | Alpha | 2 | 2 | Y | 22 | . | 22 | 1 | ||
| 28 | color | Alpha | 1 | 1 | Y | 23 | . | 23 | + | 1 | |
| 29 | insight | Alpha | 1 | 1 | Y | 24 | . | 24 | 1 | ||
| 30 | last | Alpha | 1 | 1 | Y | 25 | . | 25 | 1 |