Fiche Data Prep

Action Principale : crfScore

Code de préparation

Script en attente de validation
Copié !
1/* 1. Create sample data to score */
2DATA mycas.score_data;
3 INFILE DATALINES delimiter='|';
4 LENGTH docid $ 10 text $ 300;
5 INPUT docid $ text $;
6 DATALINES;
71|John Smith lives in New York.
82|Mary works for SAS Institute.
9;
10RUN;
11 
12/* 2. Simulate pre-existing CRF model tables (usually created by crfTrain) */
13 
14/* Label Table */
15DATA mycas.crf_label;
16 INFILE DATALINES delimiter=',';
17 LENGTH _label_ $20 _type_ $20;
18 INPUT _label_ $ _type_ $;
19 DATALINES;
20B-PER,PERSON
21I-PER,PERSON
22B-ORG,ORGANIZATION
23I-ORG,ORGANIZATION
24B-LOC,LOCATION
25I-LOC,LOCATION
26O,OTHER
27;
28RUN;
29 
30/* Attribute Table */
31DATA mycas.crf_attr;
32 INFILE DATALINES delimiter=',';
33 LENGTH _attr_ $50 _value_ $50;
34 INPUT _attr_ $ _value_ $;
35 DATALINES;
36WORD[0],John
37WORD[0],Smith
38WORD[0],lives
39WORD[0],in
40WORD[0],New
41WORD[0],York
42WORD[0],Mary
43WORD[0],works
44WORD[0],for
45WORD[0],SAS
46WORD[0],Institute
47;
48RUN;
49 
50/* Feature Table */
51DATA mycas.crf_feature;
52 INFILE DATALINES delimiter=',';
53 LENGTH _feature_ $50;
54 INPUT _feature_ $;
55 DATALINES;
56U01:York
57U02:New
58L:B-PER
59U00:John
60U00:Smith
61U00:Mary
62U00:SAS
63;
64RUN;
65 
66/* Attribute-Feature Table */
67DATA mycas.crf_attr_feature;
68 INFILE DATALINES delimiter=',';
69 INPUT _attrid_ _featureid_ _weight_ ;
70 DATALINES;
711 4 1.5
722 5 1.6
733 1 0.2
744 2 0.3
755 6 1.7
766 7 1.8
77;
78RUN;
79 
80/* Template Table */
81DATA mycas.crf_template;
82 INFILE DATALINES delimiter=',';
83 LENGTH _template_ $100;
84 INPUT _template_ $;
85 DATALINES;
86U00:%w[0]
87U01:%w[1]
88U02:%w[-1]
89L
90;
91RUN;
Actions utilisant ce script
  • conditionalRandomFields crfScore En cours
  • Aucune autre action n'utilise ce script exact.