3131 * @since FudanNLP 1.5
3232 */
3333public class FeatureGeter {
34- private int [] featrue ;
34+ private int [] feature ;
3535private EntityGroup eGroup ;
3636private Instance inst ;
3737public FeatureGeter (Instance inst ){
3838this .inst =inst ;
3939this .eGroup = (EntityGroup ) inst .getData ();
40- featrue = new int [19 ];
40+ feature = new int [19 ];
4141this .doFeature ();
4242}
4343public FeatureGeter (EntityGroup eGroup ){
44- featrue = new int [19 ];
44+ feature = new int [19 ];
4545this .eGroup = eGroup ;
4646this .doFeature ();
4747}
@@ -64,104 +64,104 @@ private void doFeature(){
6464String behindData = behind .getData ();
6565Boolean bool = this .isSub (aheadData , behindData );
6666if (bool ){ //中心词匹配
67- featrue [0 ] = 1 ;
67+ feature [0 ] = 1 ;
6868}
6969else
70- featrue [0 ] = 0 ;
70+ feature [0 ] = 0 ;
7171
7272if (ahead .getPosTag ()==PartOfSpeech .人名 ) //I为人称代词
73- featrue [1 ] = 1 ;
73+ feature [1 ] = 1 ;
7474else
75- featrue [1 ] = 0 ;
75+ feature [1 ] = 0 ;
7676if (ahead .getPosTag ()==PartOfSpeech .名词 )
77- featrue [2 ] = 1 ;
77+ feature [2 ] = 1 ;
7878else
79- featrue [2 ] = 0 ;
79+ feature [2 ] = 0 ;
8080if (ahead .getPosTag ().isEntiry ())
81- featrue [3 ] = 1 ;
81+ feature [3 ] = 1 ;
8282else
83- featrue [3 ] = 0 ;
83+ feature [3 ] = 0 ;
8484
8585if (behind .getData ().contains ("他" )||behind .getData ().contains ("她" )) //J为人称代词
86- featrue [4 ] = 1 ;
86+ feature [4 ] = 1 ;
8787else
88- featrue [4 ] = 0 ;
88+ feature [4 ] = 0 ;
8989if (behind .getData ().contains ("它" )) //J为人称代词
90- featrue [5 ] = 1 ;
90+ feature [5 ] = 1 ;
9191else
92- featrue [5 ] = 0 ;
92+ feature [5 ] = 0 ;
9393if (behind .getData ().contains ("我" )||behind .getData ().contains ("你" )) //J为人称代词
94- featrue [6 ] = 1 ;
94+ feature [6 ] = 1 ;
9595else
96- featrue [6 ] = 0 ;
96+ feature [6 ] = 0 ;
9797if (behind .getData ().contains ("自己" )) //J为人称代词
98- featrue [7 ] = 1 ;
98+ feature [7 ] = 1 ;
9999else
100- featrue [7 ] = 0 ;
100+ feature [7 ] = 0 ;
101101if (behind .getPosTag ().isPronoun ())
102- featrue [8 ] = 1 ;
102+ feature [8 ] = 1 ;
103103else
104- featrue [8 ] = 0 ;
104+ feature [8 ] = 0 ;
105105if (behindData .contains ("这" )||behindData .contains ("那" )||
106106behindData .contains ("其" )||behindData .contains ("该" )) //J为指示性名词
107- featrue [9 ] = 1 ;
107+ feature [9 ] = 1 ;
108108else
109- featrue [9 ] = 0 ;
109+ feature [9 ] = 0 ;
110110if (ahead .getPosTag ().isPronoun ())
111- featrue [8 ] = 1 ;
111+ feature [8 ] = 1 ;
112112else
113- featrue [8 ] = 0 ;
113+ feature [8 ] = 0 ;
114114if (ahead .getPosTag ()==PartOfSpeech .名词 )
115- featrue [9 ] = 1 ;
115+ feature [9 ] = 1 ;
116116else
117- featrue [9 ] = 0 ;
117+ feature [9 ] = 0 ;
118118if (ahead .getPosTag ().isEntiry ())
119- featrue [10 ] = 1 ;
119+ feature [10 ] = 1 ;
120120else
121- featrue [10 ] = 0 ;
121+ feature [10 ] = 0 ;
122122//是否性别一致
123123if (ahead .getSex ()!=behind .getSex ()&&ahead .getSex ()!=Sex .UNKONW ){
124- featrue [11 ] = 1 ;
124+ feature [11 ] = 1 ;
125125}
126126else
127- featrue [11 ] = 0 ;
127+ feature [11 ] = 0 ;
128128if (ahead .getSex ()==Sex .UNKONW ||behind .getSex ()==Sex .UNKONW )
129- featrue [12 ] = 1 ;
129+ feature [12 ] = 1 ;
130130else
131- featrue [12 ] = 0 ;
131+ feature [12 ] = 0 ;
132132//是否单复数一致
133133if (ahead .singular !=behind .singular &&ahead .singular !=Singular .UNKONW ){
134- featrue [13 ] = 1 ;
134+ feature [13 ] = 1 ;
135135}
136136else
137- featrue [13 ] = 0 ;
137+ feature [13 ] = 0 ;
138138if (ahead .singular ==Singular .UNKONW ||behind .singular ==Singular .UNKONW )
139- featrue [14 ] = 1 ;
139+ feature [14 ] = 1 ;
140140else
141- featrue [14 ] = 0 ;
141+ feature [14 ] = 0 ;
142142if (ahead .getGraTag ()==FUNC .SUB )
143- featrue [15 ]= 1 ;
143+ feature [15 ]= 1 ;
144144else
145- featrue [15 ]= 0 ;
145+ feature [15 ]= 0 ;
146146if (behind .getGraTag ()==FUNC .SUB )
147- featrue [16 ]= 1 ;
147+ feature [16 ]= 1 ;
148148else
149- featrue [16 ]= 0 ;
149+ feature [16 ]= 0 ;
150150if (ahead .getGraTag ()==FUNC .OBJ )
151- featrue [17 ]= 1 ;
151+ feature [17 ]= 1 ;
152152else
153- featrue [17 ]= 0 ;
153+ feature [17 ]= 0 ;
154154if (behind .getGraTag ()==FUNC .OBJ )
155- featrue [18 ]= 1 ;
155+ feature [18 ]= 1 ;
156156else
157- featrue [18 ]= 0 ;
157+ feature [18 ]= 0 ;
158158
159159}
160160public Instance getInst (){
161161return this .inst ;
162162}
163- public int []getFeatrue (){
164- return this .featrue ;
163+ public int []getFeature (){
164+ return this .feature ;
165165}
166166public EntityGroup getEgroup (){
167167return this .eGroup ;
0 commit comments