idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
20,600
public void setRefid ( String v ) { if ( EventArgument_Type . featOkTst && ( ( EventArgument_Type ) jcasType ) . casFeat_refid == null ) jcasType . jcas . throwFeatMissing ( "refid" , "de.julielab.jules.types.ace.EventArgument" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( EventArgument_Type ) jcasType ) . casFeatCode_refid , v ) ; }
setter for refid - sets
124
7
20,601
public Set < WordEntry > distanceMax ( String word ) { float [ ] wordVector = getWordVector ( word ) ; if ( wordVector == null ) { return null ; } Set < Entry < String , float [ ] > > entrySet = vocabulary . entrySet ( ) ; float [ ] tempVector = null ; List < WordEntry > wordEntrys = new ArrayList < WordEntry > ( topNSize ) ; for ( Entry < String , float [ ] > entry : entrySet ) { String name = entry . getKey ( ) ; if ( name . equals ( word ) ) { continue ; } float minDist = 10 , maxDist = - 10 ; tempVector = entry . getValue ( ) ; for ( int i = 0 ; i < wordVector . length ; i ++ ) { maxDist = Math . max ( wordVector [ i ] * tempVector [ i ] , maxDist ) ; minDist = Math . min ( wordVector [ i ] * tempVector [ i ] , minDist ) ; } insertTopN ( name , maxDist + minDist , wordEntrys ) ; } return new TreeSet < WordEntry > ( wordEntrys ) ; }
FAIL only counting min + max distance
248
8
20,602
protected boolean overlap ( Pair < Integer , Integer > expected , Pair < Integer , Integer > actual ) { // // a1 then a2 // if (a2.getBegin() - a1.getEnd() > 0) // return Position.before; // // // a2 then a1 // if (a1.getBegin() - a2.getEnd() > 0) // return Position.after; // // // overlap // return Position.overlap; // if ( actual . getKey ( ) >= expected . getKey ( ) && actual . getValue ( ) <= expected . getValue ( ) ) { return true ; } return false ; // full overlap is too lenient // if (expected.getKey() < actual.getValue() // && actual.getKey() < expected.getValue()) { // return true; // } // return false; }
Here we do a lenient comparison
182
7
20,603
private static final int previousSpaceIndex ( StringBuffer sb , int seek ) { seek -- ; while ( seek > 0 ) { if ( sb . charAt ( seek ) == ' ' ) { while ( seek > 0 && sb . charAt ( seek - 1 ) == ' ' ) seek -- ; return seek ; } seek -- ; } return 0 ; }
Finds the index of the nearest space before a specified index .
77
13
20,604
public FSArray getTargetList ( ) { if ( MMAXPointer_Type . featOkTst && ( ( MMAXPointer_Type ) jcasType ) . casFeat_targetList == null ) jcasType . jcas . throwFeatMissing ( "targetList" , "de.julielab.jules.types.mmax.MMAXPointer" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList ) ) ) ; }
getter for targetList - gets The MMAX annotations the pointer points at .
149
16
20,605
public void setTargetList ( FSArray v ) { if ( MMAXPointer_Type . featOkTst && ( ( MMAXPointer_Type ) jcasType ) . casFeat_targetList == null ) jcasType . jcas . throwFeatMissing ( "targetList" , "de.julielab.jules.types.mmax.MMAXPointer" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for targetList - sets The MMAX annotations the pointer points at .
145
16
20,606
public MMAXAnnotation getTargetList ( int i ) { if ( MMAXPointer_Type . featOkTst && ( ( MMAXPointer_Type ) jcasType ) . casFeat_targetList == null ) jcasType . jcas . throwFeatMissing ( "targetList" , "de.julielab.jules.types.mmax.MMAXPointer" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList ) , i ) ; return ( MMAXAnnotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList ) , i ) ) ) ; }
indexed getter for targetList - gets an indexed value - The MMAX annotations the pointer points at .
227
22
20,607
public void setTargetList ( int i , MMAXAnnotation v ) { if ( MMAXPointer_Type . featOkTst && ( ( MMAXPointer_Type ) jcasType ) . casFeat_targetList == null ) jcasType . jcas . throwFeatMissing ( "targetList" , "de.julielab.jules.types.mmax.MMAXPointer" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXPointer_Type ) jcasType ) . casFeatCode_targetList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for targetList - sets an indexed value - The MMAX annotations the pointer points at .
222
22
20,608
public Annotation getEnclosedAnnot ( ) { if ( Keep_Type . featOkTst && ( ( Keep_Type ) jcasType ) . casFeat_enclosedAnnot == null ) jcasType . jcas . throwFeatMissing ( "enclosedAnnot" , "ch.epfl.bbp.uima.types.Keep" ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Keep_Type ) jcasType ) . casFeatCode_enclosedAnnot ) ) ) ; }
getter for enclosedAnnot - gets
143
8
20,609
public void setEnclosedAnnot ( Annotation v ) { if ( Keep_Type . featOkTst && ( ( Keep_Type ) jcasType ) . casFeat_enclosedAnnot == null ) jcasType . jcas . throwFeatMissing ( "enclosedAnnot" , "ch.epfl.bbp.uima.types.Keep" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Keep_Type ) jcasType ) . casFeatCode_enclosedAnnot , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for enclosedAnnot - sets
139
8
20,610
public String getNormalizedText ( ) { if ( Keep_Type . featOkTst && ( ( Keep_Type ) jcasType ) . casFeat_normalizedText == null ) jcasType . jcas . throwFeatMissing ( "normalizedText" , "ch.epfl.bbp.uima.types.Keep" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Keep_Type ) jcasType ) . casFeatCode_normalizedText ) ; }
getter for normalizedText - gets
116
7
20,611
public void setNormalizedText ( String v ) { if ( Keep_Type . featOkTst && ( ( Keep_Type ) jcasType ) . casFeat_normalizedText == null ) jcasType . jcas . throwFeatMissing ( "normalizedText" , "ch.epfl.bbp.uima.types.Keep" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Keep_Type ) jcasType ) . casFeatCode_normalizedText , v ) ; }
setter for normalizedText - sets
119
7
20,612
public Date getPubDate ( ) { if ( PubType_Type . featOkTst && ( ( PubType_Type ) jcasType ) . casFeat_pubDate == null ) jcasType . jcas . throwFeatMissing ( "pubDate" , "de.julielab.jules.types.PubType" ) ; return ( Date ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( PubType_Type ) jcasType ) . casFeatCode_pubDate ) ) ) ; }
getter for pubDate - gets The date on which the document was published O
136
16
20,613
public void setPubDate ( Date v ) { if ( PubType_Type . featOkTst && ( ( PubType_Type ) jcasType ) . casFeat_pubDate == null ) jcasType . jcas . throwFeatMissing ( "pubDate" , "de.julielab.jules.types.PubType" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( PubType_Type ) jcasType ) . casFeatCode_pubDate , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for pubDate - sets The date on which the document was published O
133
16
20,614
public String getGramRole ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_gramRole == null ) jcasType . jcas . throwFeatMissing ( "gramRole" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_gramRole ) ; }
getter for gramRole - gets Grammatical role O
132
11
20,615
public void setGramRole ( String v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_gramRole == null ) jcasType . jcas . throwFeatMissing ( "gramRole" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_gramRole , v ) ; }
setter for gramRole - sets Grammatical role O
135
11
20,616
public String getAdv ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_adv == null ) jcasType . jcas . throwFeatMissing ( "adv" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_adv ) ; }
getter for adv - gets Adverbials are generally VP adjuncts .
127
15
20,617
public void setAdv ( String v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_adv == null ) jcasType . jcas . throwFeatMissing ( "adv" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_adv , v ) ; }
setter for adv - sets Adverbials are generally VP adjuncts .
130
15
20,618
public String getMisc ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_misc == null ) jcasType . jcas . throwFeatMissing ( "misc" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_misc ) ; }
getter for misc - gets Miscellaneous
128
7
20,619
public void setMisc ( String v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_misc == null ) jcasType . jcas . throwFeatMissing ( "misc" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_misc , v ) ; }
setter for misc - sets Miscellaneous
131
7
20,620
public String getNullElement ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_nullElement == null ) jcasType . jcas . throwFeatMissing ( "nullElement" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_nullElement ) ; }
getter for nullElement - gets
131
7
20,621
public void setNullElement ( String v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_nullElement == null ) jcasType . jcas . throwFeatMissing ( "nullElement" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_nullElement , v ) ; }
setter for nullElement - sets
134
7
20,622
public Constituent getRef ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.PTBConstituent" ) ; return ( Constituent ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_ref ) ) ) ; }
getter for ref - gets Th reference from the null constituent to the corresponding lexicalized constituent O
152
20
20,623
public void setRef ( Constituent v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_ref , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for ref - sets Th reference from the null constituent to the corresponding lexicalized constituent O
147
20
20,624
public Constituent getMap ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_map == null ) jcasType . jcas . throwFeatMissing ( "map" , "de.julielab.jules.types.PTBConstituent" ) ; return ( Constituent ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_map ) ) ) ; }
getter for map - gets In the case of gapping the reference to the corresponding constituent O
152
19
20,625
public void setMap ( Constituent v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_map == null ) jcasType . jcas . throwFeatMissing ( "map" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_map , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for map - sets In the case of gapping the reference to the corresponding constituent O
147
19
20,626
public boolean getTpc ( ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_tpc == null ) jcasType . jcas . throwFeatMissing ( "tpc" , "de.julielab.jules.types.PTBConstituent" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_tpc ) ; }
getter for tpc - gets Marks elements that appear before the subject in a declarative sentence O
132
21
20,627
public void setTpc ( boolean v ) { if ( PTBConstituent_Type . featOkTst && ( ( PTBConstituent_Type ) jcasType ) . casFeat_tpc == null ) jcasType . jcas . throwFeatMissing ( "tpc" , "de.julielab.jules.types.PTBConstituent" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( PTBConstituent_Type ) jcasType ) . casFeatCode_tpc , v ) ; }
setter for tpc - sets Marks elements that appear before the subject in a declarative sentence O
135
21
20,628
public List < java . lang . Object > getStartPageOrEndPageOrMedlinePgn ( ) { if ( startPageOrEndPageOrMedlinePgn == null ) { startPageOrEndPageOrMedlinePgn = new ArrayList < java . lang . Object > ( ) ; } return this . startPageOrEndPageOrMedlinePgn ; }
Gets the value of the startPageOrEndPageOrMedlinePgn property .
79
18
20,629
private boolean matchRuleExceptions ( RuleException [ ] exceptions , CAS aCAS , AnnotationFS annot ) { // if we have already checked the exceptions for the current match type // annotation, return the // last result - this can happen in case of MATCH_ALL match strategy if ( this . lastRuleExceptionAnnotation == annot ) { return this . lastRuleExceptionMatch ; } // loop over all rule exceptions for ( int i = 0 ; i < exceptions . length ; i ++ ) { // store current match type annotation for performance reason. In case // of MATCH_ALL match // strategy maybe the matchRuleException() method is called multiple // times for the same // match type annotations and in that case the result of the rule // exception match is exactly // the same. this . lastRuleExceptionAnnotation = annot ; // find covering annotation AnnotationFS coverFs = findCoverFS ( aCAS , annot , exceptions [ i ] . getType ( ) ) ; // check if covering annotation was found if ( coverFs != null ) { // check if the found coverFs annotation match the exception pattern if ( exceptions [ i ] . matchPattern ( coverFs ) ) { this . lastRuleExceptionMatch = true ; return this . lastRuleExceptionMatch ; } } } this . lastRuleExceptionMatch = false ; return false ; }
Check if the rule exception match for the current match type annotation .
277
13
20,630
private AnnotationFS findCoverFS ( CAS aCAS , AnnotationFS annot , Type coverFsType ) { // covering annotation AnnotationFS coverFs = null ; // create a searchFS of the coverFsType with the annot boundaries to // search for it. FeatureStructure searchFs = aCAS . createAnnotation ( coverFsType , annot . getBegin ( ) , aCAS . getDocumentText ( ) . length ( ) ) ; // get the coverFSType iterator from the CAS and move it "near" to the // position of the created searchFS. FSIterator < ? > iterator = aCAS . getAnnotationIndex ( coverFsType ) . iterator ( ) ; iterator . moveTo ( searchFs ) ; // now the iterator can either point directly to the FS we are searching // or it points to the next higher FS in the list. So we either have // already found the correct one, of we maybe have to move the iterator to // the previous position. // check if the iterator at the current position is valid if ( iterator . isValid ( ) ) { // iterator is valid, so we either have the correct annotation of we // have to move to the // previous one, lets check the current FS from the iterator // get current FS coverFs = ( AnnotationFS ) iterator . get ( ) ; // check if the coverFS covers the current match type annotation if ( ( coverFs . getBegin ( ) <= annot . getBegin ( ) ) && ( coverFs . getEnd ( ) >= annot . getEnd ( ) ) ) { // we found the covering annotation return coverFs ; } // current coverFs does not cover the current match type annotation // lets try to move iterator to the previous annotation and check // again iterator . moveToPrevious ( ) ; // check if the iterator is still valid after me move it to the // previous FS if ( iterator . isValid ( ) ) { // get FS coverFs = ( AnnotationFS ) iterator . get ( ) ; // check the found coverFS covers the current match type // annotation if ( ( coverFs . getBegin ( ) <= annot . getBegin ( ) ) && ( coverFs . getEnd ( ) >= annot . getEnd ( ) ) ) { // we found the covering annotation return coverFs ; } } } // iterator is invalid lets try to move the iterator to the last FS and // check the FS iterator . moveToLast ( ) ; // check if the iterator is valid after we move it if ( iterator . isValid ( ) ) { // get FS coverFs = ( AnnotationFS ) iterator . get ( ) ; // check the found coverFS covers the current match type annotation if ( ( coverFs . getBegin ( ) <= annot . getBegin ( ) ) && ( coverFs . getEnd ( ) >= annot . getEnd ( ) ) ) { // we found the covering annotation return coverFs ; } } // no covering annotation found return null ; }
Finds the covering annotation of the specified coverFSType for the given annotation .
617
17
20,631
private String replaceMatchGroupValues ( String featureValue , Matcher matcher , Rule rule ) throws RegexAnnotatorProcessException { StringBuffer replaced = new StringBuffer ( ) ; int pos = 0 ; int end = featureValue . length ( ) ; char c ; // Iterate over the input text to find the match groups that must be // replaced. // In the input text, all $ and \ characters must be escaped by \. while ( pos < end ) { c = featureValue . charAt ( pos ) ; // Everything followed by a \ was escaped and the \ (escape character) // can be removed now if ( c == ' ' ) { // skip escape character ++ pos ; // add escaped character to the output if ( pos < end ) { replaced . append ( featureValue . charAt ( pos ) ) ; // go to the next character ++ pos ; } } else if ( c == ' ' ) { // this must be a match group $n since all other $ characters must // be escaped with a \ which is handled above. // skip $ character we are only interested in the match group number // or name // match group name syntax is ${match group name} ++ pos ; if ( pos < end ) { // get next char to check if we have a match group number or a // match group name c = featureValue . charAt ( pos ) ; int groupNumber = - 1 ; if ( c == ' ' ) { // we have a match group name // skip grace '{' ++ pos ; // get match group name int matchNameEnd = featureValue . indexOf ( "}" , pos ) ; if ( matchNameEnd > - 1 ) { String matchGroupName = featureValue . substring ( pos , matchNameEnd ) ; // get match group number for the given match group name groupNumber = rule . getMatchGroupNumber ( matchGroupName ) ; if ( groupNumber == - 1 ) { throw new RegexAnnotatorProcessException ( "regex_annotator_error_match_group_name_not_found" , new Object [ ] { matchGroupName , rule . getId ( ) } ) ; } // set pos to the end of the match group name syntax pos = matchNameEnd + 1 ; } } else { // we have a match group number // convert match group number to integer value groupNumber = c - ' ' ; // skip match group number ++ pos ; } // get match group content String groupMatch = matcher . group ( groupNumber ) ; // add match group content to the output if ( groupMatch != null ) { replaced . append ( groupMatch ) ; } } } else { // default output character that is added to the output replaced . append ( c ) ; ++ pos ; } } return replaced . toString ( ) ; }
replace the string containing match group syntax with the current match group values .
584
14
20,632
public String getDocid ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_docid == null ) jcasType . jcas . throwFeatMissing ( "docid" , "de.julielab.jules.types.ace.Document" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_docid ) ; }
getter for docid - gets
113
7
20,633
public void setDocid ( String v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_docid == null ) jcasType . jcas . throwFeatMissing ( "docid" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_docid , v ) ; }
setter for docid - sets
116
7
20,634
public FSArray getEntities ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_entities == null ) jcasType . jcas . throwFeatMissing ( "entities" , "de.julielab.jules.types.ace.Document" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities ) ) ) ; }
getter for entities - gets
136
6
20,635
public void setEntities ( FSArray v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_entities == null ) jcasType . jcas . throwFeatMissing ( "entities" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for entities - sets
132
6
20,636
public Entity getEntities ( int i ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_entities == null ) jcasType . jcas . throwFeatMissing ( "entities" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities ) , i ) ; return ( Entity ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities ) , i ) ) ) ; }
indexed getter for entities - gets an indexed value -
205
12
20,637
public void setEntities ( int i , Entity v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_entities == null ) jcasType . jcas . throwFeatMissing ( "entities" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_entities ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for entities - sets an indexed value -
203
12
20,638
public FSArray getValues ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_values == null ) jcasType . jcas . throwFeatMissing ( "values" , "de.julielab.jules.types.ace.Document" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values ) ) ) ; }
getter for values - gets
132
6
20,639
public void setValues ( FSArray v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_values == null ) jcasType . jcas . throwFeatMissing ( "values" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for values - sets
128
6
20,640
public Entity getValues ( int i ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_values == null ) jcasType . jcas . throwFeatMissing ( "values" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values ) , i ) ; return ( Entity ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values ) , i ) ) ) ; }
indexed getter for values - gets an indexed value -
200
12
20,641
public void setValues ( int i , Entity v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_values == null ) jcasType . jcas . throwFeatMissing ( "values" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_values ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for values - sets an indexed value -
198
12
20,642
public FSArray getTimex2 ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_timex2 == null ) jcasType . jcas . throwFeatMissing ( "timex2" , "de.julielab.jules.types.ace.Document" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 ) ) ) ; }
getter for timex2 - gets
140
8
20,643
public void setTimex2 ( FSArray v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_timex2 == null ) jcasType . jcas . throwFeatMissing ( "timex2" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for timex2 - sets
136
8
20,644
public Timex2 getTimex2 ( int i ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_timex2 == null ) jcasType . jcas . throwFeatMissing ( "timex2" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 ) , i ) ; return ( Timex2 ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 ) , i ) ) ) ; }
indexed getter for timex2 - gets an indexed value -
214
14
20,645
public void setTimex2 ( int i , Timex2 v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_timex2 == null ) jcasType . jcas . throwFeatMissing ( "timex2" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_timex2 ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for timex2 - sets an indexed value -
210
14
20,646
public FSArray getRelations ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_relations == null ) jcasType . jcas . throwFeatMissing ( "relations" , "de.julielab.jules.types.ace.Document" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations ) ) ) ; }
getter for relations - gets
132
6
20,647
public void setRelations ( FSArray v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_relations == null ) jcasType . jcas . throwFeatMissing ( "relations" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for relations - sets
128
6
20,648
public Relation getRelations ( int i ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_relations == null ) jcasType . jcas . throwFeatMissing ( "relations" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations ) , i ) ; return ( Relation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations ) , i ) ) ) ; }
indexed getter for relations - gets an indexed value -
202
12
20,649
public void setRelations ( int i , Relation v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_relations == null ) jcasType . jcas . throwFeatMissing ( "relations" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_relations ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for relations - sets an indexed value -
199
12
20,650
public FSArray getEvents ( ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_events == null ) jcasType . jcas . throwFeatMissing ( "events" , "de.julielab.jules.types.ace.Document" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events ) ) ) ; }
getter for events - gets
132
6
20,651
public void setEvents ( FSArray v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_events == null ) jcasType . jcas . throwFeatMissing ( "events" , "de.julielab.jules.types.ace.Document" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for events - sets
128
6
20,652
public Event getEvents ( int i ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_events == null ) jcasType . jcas . throwFeatMissing ( "events" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events ) , i ) ; return ( Event ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events ) , i ) ) ) ; }
indexed getter for events - gets an indexed value -
200
12
20,653
public void setEvents ( int i , Event v ) { if ( Document_Type . featOkTst && ( ( Document_Type ) jcasType ) . casFeat_events == null ) jcasType . jcas . throwFeatMissing ( "events" , "de.julielab.jules.types.ace.Document" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Document_Type ) jcasType ) . casFeatCode_events ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for events - sets an indexed value -
198
12
20,654
public String sprintf ( double x ) throws IllegalArgumentException { Enumeration e = vFmt . elements ( ) ; ConversionSpecification cs = null ; char c = 0 ; StringBuffer sb = new StringBuffer ( ) ; while ( e . hasMoreElements ( ) ) { cs = ( ConversionSpecification ) e . nextElement ( ) ; c = cs . getConversionCharacter ( ) ; if ( c == ' ' ) sb . append ( cs . getLiteral ( ) ) ; else if ( c == ' ' ) sb . append ( "%" ) ; else sb . append ( cs . internalsprintf ( x ) ) ; } return sb . toString ( ) ; }
Format a double .
153
4
20,655
public InstanceList [ ] split ( java . util . Random r , int _nfolds ) { List < Integer > articleIds = newArrayList ( instanceArticles . keySet ( ) ) ; Collections . shuffle ( articleIds , r ) ; final int nrSentences = instanceArticles . size ( ) ; final int nrSentencesPerSplit = ( int ) ( nrSentences / ( double ) _nfolds ) ; int runningSplitId = 0 ; int runningSentencesPerSplit = 0 ; InstanceList [ ] splitted = new InstanceList [ _nfolds ] ; for ( int i = 0 ; i < splitted . length ; i ++ ) { splitted [ i ] = new InstanceList ( pipe ) ; } for ( int i = 0 ; i < articleIds . size ( ) ; i ++ ) { // add all sentences from this article for ( Instance sentence : instanceArticles . get ( articleIds . get ( i ) ) ) { // System.out.println(format("adding {} to split {}", // sentence.name, runningSplitId)); splitted [ runningSplitId ] . add ( sentence ) ; runningSentencesPerSplit ++ ; } // move to next split? if ( runningSentencesPerSplit > nrSentencesPerSplit && runningSplitId < ( _nfolds - 1 ) ) { runningSplitId ++ ; runningSentencesPerSplit -= nrSentencesPerSplit ; } } // some stats LOG . debug ( "{} sentences in {} splits" , nrSentences , _nfolds ) ; for ( InstanceList iList : splitted ) { LOG . debug ( "size:: " + iList . size ( ) ) ; } return splitted ; }
Shuffles the elements of this list among several smaller lists .
377
13
20,656
public InstanceList [ ] nextSplit ( int numTrainFolds ) { InstanceList [ ] ret = new InstanceList [ 2 ] ; ret [ 0 ] = new InstanceList ( pipe ) ; ret [ 1 ] = new InstanceList ( pipe ) ; // train on folds [index, index+numTrainFolds), test on rest for ( int i = 0 ; i < folds . length ; i ++ ) { int foldno = ( index + i ) % folds . length ; InstanceList addTo ; if ( i < numTrainFolds ) { addTo = ret [ 0 ] ; } else { addTo = ret [ 1 ] ; } Iterator < Instance > iter = folds [ foldno ] . iterator ( ) ; while ( iter . hasNext ( ) ) addTo . add ( iter . next ( ) ) ; } index ++ ; return ret ; }
Returns the next split given the number of folds you want in the training data .
188
16
20,657
public int getBlock ( ) { if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_block == null ) jcasType . jcas . throwFeatMissing ( "block" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_block ) ; }
getter for block - gets
112
6
20,658
public void setBlock ( int v ) { if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_block == null ) jcasType . jcas . throwFeatMissing ( "block" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_block , v ) ; }
setter for block - sets
115
6
20,659
public String getLineText ( ) { if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_lineText == null ) jcasType . jcas . throwFeatMissing ( "lineText" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_lineText ) ; }
getter for lineText - gets workaround to get the line text
116
13
20,660
public void setLineText ( String v ) { if ( DocumentLine_Type . featOkTst && ( ( DocumentLine_Type ) jcasType ) . casFeat_lineText == null ) jcasType . jcas . throwFeatMissing ( "lineText" , "ch.epfl.bbp.uima.types.DocumentLine" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( DocumentLine_Type ) jcasType ) . casFeatCode_lineText , v ) ; }
setter for lineText - sets workaround to get the line text
119
13
20,661
public String getTypeS ( ) { if ( Gold_Type . featOkTst && ( ( Gold_Type ) jcasType ) . casFeat_typeS == null ) jcasType . jcas . throwFeatMissing ( "typeS" , "ch.epfl.bbp.uima.types.Gold" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Gold_Type ) jcasType ) . casFeatCode_typeS ) ; }
getter for typeS - gets
112
7
20,662
public void setTypeS ( String v ) { if ( Gold_Type . featOkTst && ( ( Gold_Type ) jcasType ) . casFeat_typeS == null ) jcasType . jcas . throwFeatMissing ( "typeS" , "ch.epfl.bbp.uima.types.Gold" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Gold_Type ) jcasType ) . casFeatCode_typeS , v ) ; }
setter for typeS - sets
115
7
20,663
public DoubleArray getScores ( ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_scores == null ) jcasType . jcas . throwFeatMissing ( "scores" , "ch.epfl.bbp.uima.types.Topic" ) ; return ( DoubleArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores ) ) ) ; }
getter for scores - gets
135
6
20,664
public void setScores ( DoubleArray v ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_scores == null ) jcasType . jcas . throwFeatMissing ( "scores" , "ch.epfl.bbp.uima.types.Topic" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for scores - sets
131
6
20,665
public double getScores ( int i ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_scores == null ) jcasType . jcas . throwFeatMissing ( "scores" , "ch.epfl.bbp.uima.types.Topic" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores ) , i ) ; return jcasType . ll_cas . ll_getDoubleArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores ) , i ) ; }
indexed getter for scores - gets an indexed value -
183
12
20,666
public void setScores ( int i , double v ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_scores == null ) jcasType . jcas . throwFeatMissing ( "scores" , "ch.epfl.bbp.uima.types.Topic" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores ) , i ) ; jcasType . ll_cas . ll_setDoubleArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_scores ) , i , v ) ; }
indexed setter for scores - sets an indexed value -
187
12
20,667
public int getMostLikelyTopic ( ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_mostLikelyTopic == null ) jcasType . jcas . throwFeatMissing ( "mostLikelyTopic" , "ch.epfl.bbp.uima.types.Topic" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_mostLikelyTopic ) ; }
getter for mostLikelyTopic - gets The most likely topic id for this topic
120
17
20,668
public void setMostLikelyTopic ( int v ) { if ( Topic_Type . featOkTst && ( ( Topic_Type ) jcasType ) . casFeat_mostLikelyTopic == null ) jcasType . jcas . throwFeatMissing ( "mostLikelyTopic" , "ch.epfl.bbp.uima.types.Topic" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( Topic_Type ) jcasType ) . casFeatCode_mostLikelyTopic , v ) ; }
setter for mostLikelyTopic - sets The most likely topic id for this topic
123
17
20,669
protected void updateOutgoingEdgesStateM ( int currS , int currL , int prevS , int prevL , Emissions emission ) { updateOutgoingEdges ( currS , currL , States . M , prevS , prevL , States . DL , Transitions . t_DL_to_M , emission ) ; updateOutgoingEdges ( currS , currL , States . M , prevS , prevL , States . M , Transitions . t_M_in , emission ) ; updateOutgoingEdges ( currS , currL , States . M , prevS , prevL , States . D , Transitions . t_D_to_M , emission ) ; updateOutgoingEdges ( currS , currL , States . M , prevS , prevL , States . S , Transitions . t_S_to_M , emission ) ; }
Enumerates the possible transitions into state M .
200
10
20,670
protected void updateOutgoingEdgesStateD ( int currS , int currL , int prevS , int prevL , Emissions emission ) { updateOutgoingEdges ( currS , currL , States . D , prevS , prevL , States . D , Transitions . t_D_in , emission ) ; updateOutgoingEdges ( currS , currL , States . D , prevS , prevL , States . M , Transitions . t_M_to_D , emission ) ; }
Enumerates the possible transitions into state D .
116
10
20,671
protected void updateOutgoingEdgesStateDL ( int currS , int currL , int prevS , int prevL , Emissions emission ) { updateOutgoingEdges ( currS , currL , States . DL , prevS , prevL , States . DL , Transitions . t_DL_in , emission ) ; updateOutgoingEdges ( currS , currL , States . DL , prevS , prevL , States . S , Transitions . t_S_to_DL , emission ) ; }
Enumerates the possible transitions into state DL .
116
10
20,672
protected void updateOutgoingEdgesStateEND ( int currS , int currL , int prevS , int prevL , Emissions emission ) { updateOutgoingEdges ( currS , currL , States . END , prevS , prevL , States . D , Transitions . t_D_to_END , emission ) ; updateOutgoingEdges ( currS , currL , States . END , prevS , prevL , States . M , Transitions . t_M_to_END , emission ) ; }
Enumerates the possible transitions into state END .
118
10
20,673
public String getRule ( ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_rule == null ) jcasType . jcas . throwFeatMissing ( "rule" , "com.digitalpebble.rasp.Clause" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_rule ) ; }
getter for rule - gets
106
6
20,674
public void setRule ( String v ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_rule == null ) jcasType . jcas . throwFeatMissing ( "rule" , "com.digitalpebble.rasp.Clause" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_rule , v ) ; }
setter for rule - sets
109
6
20,675
public FSArray getSubclauses ( ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_subclauses == null ) jcasType . jcas . throwFeatMissing ( "subclauses" , "com.digitalpebble.rasp.Clause" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses ) ) ) ; }
getter for subclauses - gets array of subelements . contains WordForms or Clauses
141
22
20,676
public void setSubclauses ( FSArray v ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_subclauses == null ) jcasType . jcas . throwFeatMissing ( "subclauses" , "com.digitalpebble.rasp.Clause" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for subclauses - sets array of subelements . contains WordForms or Clauses
137
22
20,677
public Annotation getSubclauses ( int i ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_subclauses == null ) jcasType . jcas . throwFeatMissing ( "subclauses" , "com.digitalpebble.rasp.Clause" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses ) , i ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses ) , i ) ) ) ; }
indexed getter for subclauses - gets an indexed value - array of subelements . contains WordForms or Clauses
214
28
20,678
public void setSubclauses ( int i , Annotation v ) { if ( Clause_Type . featOkTst && ( ( Clause_Type ) jcasType ) . casFeat_subclauses == null ) jcasType . jcas . throwFeatMissing ( "subclauses" , "com.digitalpebble.rasp.Clause" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Clause_Type ) jcasType ) . casFeatCode_subclauses ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for subclauses - sets an indexed value - array of subelements . contains WordForms or Clauses
211
28
20,679
public String getProbability ( ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_probability == null ) jcasType . jcas . throwFeatMissing ( "probability" , "de.julielab.jules.types.EventTrigger" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_probability ) ; }
getter for probability - gets probability of this trigger to be an event or relation trigger
119
17
20,680
public void setProbability ( String v ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_probability == null ) jcasType . jcas . throwFeatMissing ( "probability" , "de.julielab.jules.types.EventTrigger" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_probability , v ) ; }
setter for probability - sets probability of this trigger to be an event or relation trigger
122
17
20,681
public String getSpecifity ( ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_specifity == null ) jcasType . jcas . throwFeatMissing ( "specifity" , "de.julielab.jules.types.EventTrigger" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_specifity ) ; }
getter for specifity - gets specifity to be an event trigger compare with using in other context
119
22
20,682
public void setSpecifity ( String v ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_specifity == null ) jcasType . jcas . throwFeatMissing ( "specifity" , "de.julielab.jules.types.EventTrigger" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_specifity , v ) ; }
setter for specifity - sets specifity to be an event trigger compare with using in other context
122
22
20,683
public String getImportance ( ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_importance == null ) jcasType . jcas . throwFeatMissing ( "importance" , "de.julielab.jules.types.EventTrigger" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_importance ) ; }
getter for importance - gets how important is this trigger for the event
115
14
20,684
public void setImportance ( String v ) { if ( EventTrigger_Type . featOkTst && ( ( EventTrigger_Type ) jcasType ) . casFeat_importance == null ) jcasType . jcas . throwFeatMissing ( "importance" , "de.julielab.jules.types.EventTrigger" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( EventTrigger_Type ) jcasType ) . casFeatCode_importance , v ) ; }
setter for importance - sets how important is this trigger for the event
118
14
20,685
public String getStoryID ( ) { if ( MUC7Header_Type . featOkTst && ( ( MUC7Header_Type ) jcasType ) . casFeat_storyID == null ) jcasType . jcas . throwFeatMissing ( "storyID" , "de.julielab.jules.types.muc7.MUC7Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( MUC7Header_Type ) jcasType ) . casFeatCode_storyID ) ; }
getter for storyID - gets the storyID of the MUC7 documents
127
16
20,686
public void setStoryID ( String v ) { if ( MUC7Header_Type . featOkTst && ( ( MUC7Header_Type ) jcasType ) . casFeat_storyID == null ) jcasType . jcas . throwFeatMissing ( "storyID" , "de.julielab.jules.types.muc7.MUC7Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( MUC7Header_Type ) jcasType ) . casFeatCode_storyID , v ) ; }
setter for storyID - sets the storyID of the MUC7 documents
130
16
20,687
public String explainScore ( StringWrapper s , StringWrapper t ) { StringBuffer buf = new StringBuffer ( ) ; BagOfTokens sBag = asBagOfTokens ( s ) ; BagOfTokens tBag = asBagOfTokens ( t ) ; double sumOverI = 0 ; for ( Iterator i = sBag . tokenIterator ( ) ; i . hasNext ( ) ; ) { Token tokenI = ( Token ) i . next ( ) ; buf . append ( "token=" + tokenI ) ; double maxOverJ = - Double . MAX_VALUE ; Token closestToI = null ; for ( Iterator j = tBag . tokenIterator ( ) ; j . hasNext ( ) ; ) { Token tokenJ = ( Token ) j . next ( ) ; double scoreItoJ = tokenDistance . score ( tokenI . getValue ( ) , tokenJ . getValue ( ) ) ; buf . append ( " dist(" + tokenJ . getValue ( ) + ")=" + scoreItoJ ) ; if ( scoreItoJ >= maxOverJ ) { maxOverJ = scoreItoJ ; closestToI = tokenJ ; } } sumOverI += maxOverJ ; buf . append ( " match=" + closestToI + " score=" + maxOverJ + "\n" ) ; } buf . append ( "total: " + sumOverI + "/" + sBag . size ( ) + " = " + score ( s , t ) + "\n" ) ; return buf . toString ( ) ; }
Explain how the distance was computed .
337
8
20,688
public static void main ( String [ ] args ) throws IOException { if ( args . length < 1 ) { System . out . println ( "Usage: java opennlp.maxent.io.OldFormatGISModelReader model_name_prefix (new_model_name)" ) ; System . exit ( 0 ) ; } int nameIndex = 0 ; String infilePrefix = args [ nameIndex ] ; String outfile ; if ( args . length > nameIndex ) outfile = args [ nameIndex + 1 ] ; else outfile = infilePrefix + ".bin.gz" ; GISModelReader reader = new OldFormatGISModelReader ( infilePrefix ) ; new SuffixSensitiveGISModelWriter ( reader . getModel ( ) , new File ( outfile ) ) . persist ( ) ; }
Convert a model created with Maxent 1 . 0 to a format used with Maxent 1 . 2 .
177
22
20,689
public void put ( String string , Object value ) { if ( frozen ) throw new IllegalStateException ( "can't add new values to a frozen dictionary" ) ; Set valset = ( Set ) valueMap . get ( string ) ; if ( valset == null ) valueMap . put ( string , ( valset = new HashSet ( ) ) ) ; valset . add ( value ) ; }
Insert a string into the dictionary and associate it with the given value .
88
14
20,690
public void freeze ( ) { if ( frozen ) return ; // train the TFIDF distance on all strings seen trainDistances ( ) ; // now, compute the maxScore of each token, and create an inverted index if ( DEBUG ) System . out . println ( "computing maxScore of " + tokenizer . maxTokenIndex ( ) + " tokens" ) ; invertedIndex = new Set [ tokenizer . maxTokenIndex ( ) + 1 ] ; maxTFIDFScore = new double [ tokenizer . maxTokenIndex ( ) + 1 ] ; for ( Iterator i = valueMap . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String s = ( String ) i . next ( ) ; tfidfDistance . prepare ( s ) ; Token [ ] tokens = tfidfDistance . getTokens ( ) ; for ( int j = 0 ; j < tokens . length ; j ++ ) { Token tok = tokens [ j ] ; double w = tfidfDistance . getWeight ( tok ) ; maxTFIDFScore [ tok . getIndex ( ) ] = Math . max ( maxTFIDFScore [ tok . getIndex ( ) ] , w ) ; Set ii = invertedIndex [ tok . getIndex ( ) ] ; if ( ii == null ) ii = invertedIndex [ tok . getIndex ( ) ] = new HashSet ( ) ; ii . add ( s ) ; //if (DEBUG) System.out.println("adjust maxscore, invertedIndex for "+tok); } } // find out which tokens are similar to which other tokens if ( DEBUG ) System . out . println ( "computing similar-tokens for " + tokenizer . maxTokenIndex ( ) + " tokens, window=" + windowSize ) ; allTokens = new Token [ tokenizer . maxTokenIndex ( ) ] ; numTokens = 0 ; for ( Iterator i = tokenizer . tokenIterator ( ) ; i . hasNext ( ) ; ) { Token toki = ( Token ) i . next ( ) ; allTokens [ numTokens ++ ] = toki ; } Arrays . sort ( allTokens , LEXICAL_ORDER_FOR_TOKENS ) ; similarTokens = new Token [ tokenizer . maxTokenIndex ( ) + 1 ] [ ] ; for ( int i = 0 ; i < numTokens ; i ++ ) { Token toki = allTokens [ i ] ; Set likeTokI = findSimilarTokens ( toki . getValue ( ) , i ) ; similarTokens [ toki . getIndex ( ) ] = new Token [ likeTokI . size ( ) ] ; int k = 0 ; for ( Iterator j = likeTokI . iterator ( ) ; j . hasNext ( ) ; ) { Token tokj = ( Token ) j . next ( ) ; similarTokens [ toki . getIndex ( ) ] [ k ++ ] = tokj ; } } frozen = true ; }
Make it impossible to add new values but possible to perform lookups .
629
14
20,691
private Set findSimilarTokens ( String s , int i ) { Set likeTokI = new HashSet ( ) ; for ( int j = Math . max ( 0 , i - windowSize ) ; j < Math . min ( i + windowSize , numTokens ) ; j ++ ) { if ( i != j ) { Token tokj = allTokens [ j ] ; double d = jaroWinklerDistance . score ( s , tokj . getValue ( ) ) ; if ( d >= minTokenSimilarity ) likeTokI . add ( tokj ) ; } } return likeTokI ; }
position of s in the list allTokens
127
8
20,692
public int slowLookup ( double minScore , String toFind ) { if ( ! frozen ) freeze ( ) ; long start = System . currentTimeMillis ( ) ; StringWrapper wa = softTFIDFDistance . prepare ( toFind ) ; result = new ArrayList ( ) ; for ( Iterator i = valueMap . keySet ( ) . iterator ( ) ; i . hasNext ( ) ; ) { String found = ( String ) i . next ( ) ; StringWrapper wb = softTFIDFDistance . prepare ( found ) ; double d = softTFIDFDistance . score ( wa , wb ) ; if ( d >= minScore ) { Set valset = ( Set ) valueMap . get ( found ) ; for ( Iterator j = valset . iterator ( ) ; j . hasNext ( ) ; ) { String valj = ( String ) j . next ( ) ; result . add ( new LookupResult ( found , valj , d ) ) ; } } } Collections . sort ( result ) ; lookupTime = ( System . currentTimeMillis ( ) - start ) / 1000.0 ; return result . size ( ) ; }
Exactly like lookup but works by exhaustively checking every stored string .
250
13
20,693
private void storeUpperBound ( Token tok , Token simTok , List usefulTokens , Map upperBoundOnWeight , double sim ) { double upperBound = tfidfDistance . getWeight ( tok ) * maxTFIDFScore [ simTok . getIndex ( ) ] * sim ; if ( DEBUG ) System . out . println ( "upper-bounding tok " + simTok + " sim=" + sim + " to " + tok + " upperBound " + upperBound ) ; if ( DEBUG ) System . out . println ( "upperBound = " + tfidfDistance . getWeight ( tok ) + "*" + maxTFIDFScore [ simTok . getIndex ( ) ] + "*" + sim ) ; usefulTokens . add ( simTok ) ; upperBoundOnWeight . put ( simTok , new Double ( upperBound ) ) ; }
subroutine of lookup
188
5
20,694
public void addLine ( String line ) { try { writer . append ( line ) ; writer . newLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
add text and a new line
44
6
20,695
public void addText ( String text ) { try { writer . append ( text ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
add text without new line
37
5
20,696
private double [ ] multiScore ( MultiStringWrapper ms , MultiStringWrapper mt ) { if ( ms . size ( ) != mt . size ( ) ) { throw new IllegalArgumentException ( "inputs have different numbers of fields" ) ; } int n = ms . size ( ) ; double scores [ ] = new double [ n ] ; for ( int i = 0 ; i < n ; i ++ ) { scores [ i ] = getDistance ( i ) . score ( ms . get ( i ) , mt . get ( i ) ) ; } return scores ; }
Compute the scores for each primitive distance function on each field .
122
13
20,697
final public double score ( String s , String t ) { return score ( prepare ( s ) , prepare ( t ) ) ; }
Strings are scored by converting them to StringWrappers with the prepare function .
27
16
20,698
final public String explainScore ( String s , String t ) { return explainScore ( prepare ( s ) , prepare ( t ) ) ; }
Scores are explained by converting Strings to StringWrappers with the prepare function .
29
17
20,699
final public StringWrapper prepare ( String s ) { MultiStringWrapper ms = new MultiStringWrapper ( s , delim ) ; if ( ! isLegalMultiStringWrapperSize ( ms . size ( ) ) ) { throw new IllegalArgumentException ( "string has invalid number of fields" ) ; } for ( int i = 0 ; i < ms . size ( ) ; i ++ ) { ms . set ( i , getDistance ( i ) . prepare ( ms . get ( i ) . unwrap ( ) ) ) ; } return ms ; }
Prepare a string .
117
5