idx
int64
0
165k
question
stringlengths
73
5.81k
target
stringlengths
5
918
20,700
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 -
20,701
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 -
20,702
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
20,703
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
20,704
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 .
20,705
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 .
20,706
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 .
20,707
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 .
20,708
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
20,709
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
20,710
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
20,711
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
20,712
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
20,713
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
20,714
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
20,715
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
20,716
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
20,717
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
20,718
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
20,719
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
20,720
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
20,721
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
20,722
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 .
20,723
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 .
20,724
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 .
20,725
public void freeze ( ) { if ( frozen ) return ; trainDistances ( ) ; 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 ( "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 .
20,726
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
20,727
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 .
20,728
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
20,729
public void addLine ( String line ) { try { writer . append ( line ) ; writer . newLine ( ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
add text and a new line
20,730
public void addText ( String text ) { try { writer . append ( text ) ; } catch ( IOException e ) { e . printStackTrace ( ) ; } }
add text without new line
20,731
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 .
20,732
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 .
20,733
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 .
20,734
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 .
20,735
final protected static void doMain ( StringDistance d , String [ ] argv ) { if ( argv . length != 2 ) { System . out . println ( "usage: string1 string2" ) ; } else { System . out . println ( d . explainScore ( argv [ 0 ] , argv [ 1 ] ) ) ; } }
Default main routine for testing
20,736
public int getAlignedChar ( int iMinusOne , boolean preferHigherIndices ) { int i = iMinusOne + 1 ; int bestJ = - 1 ; double bestScore = - Double . MAX_VALUE ; for ( int j = mat . getFirstStoredEntryInRow ( i ) ; j <= mat . getLastStoredEntryInRow ( i ) ; j ++ ) { if ( mat . outOfRange ( i , j ) ) log . error ( "out of range: " + i + "," + j ) ; double score = mat . get ( i , j ) ; if ( ( score > bestScore ) || ( score == bestScore && preferHigherIndices ) ) { bestScore = score ; bestJ = j ; } } return bestJ - 1 ; }
Find a character in the first string s that can be aligned with the i - th character in the second string t .
20,737
public String getCopyright ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_copyright == null ) jcasType . jcas . throwFeatMissing ( "copyright" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_copyright ) ; }
getter for copyright - gets Copyright information C
20,738
public void setCopyright ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_copyright == null ) jcasType . jcas . throwFeatMissing ( "copyright" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_copyright , v ) ; }
setter for copyright - sets Copyright information C
20,739
public boolean getTruncated ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_truncated == null ) jcasType . jcas . throwFeatMissing ( "truncated" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_truncated ) ; }
getter for truncated - gets Indicates whether the document is truncated C
20,740
public void setTruncated ( boolean v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_truncated == null ) jcasType . jcas . throwFeatMissing ( "truncated" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_truncated , v ) ; }
setter for truncated - sets Indicates whether the document is truncated C
20,741
public FSArray getAuthors ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) ) ) ; }
getter for authors - gets The authors of the document O
20,742
public void setAuthors ( FSArray v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for authors - sets The authors of the document O
20,743
public AuthorInfo getAuthors ( int i ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ; return ( AuthorInfo ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ) ) ; }
indexed getter for authors - gets an indexed value - The authors of the document O
20,744
public void setAuthors ( int i , AuthorInfo v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for authors - sets an indexed value - The authors of the document O
20,745
public FSArray getPubTypeList ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) ) ) ; }
getter for pubTypeList - gets The list of the publication types O
20,746
public void setPubTypeList ( FSArray v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for pubTypeList - sets The list of the publication types O
20,747
public PubType getPubTypeList ( int i ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ; return ( PubType ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ) ) ; }
indexed getter for pubTypeList - gets an indexed value - The list of the publication types O
20,748
public void setPubTypeList ( int i , PubType v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for pubTypeList - sets an indexed value - The list of the publication types O
20,749
public String getLanguage ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_language == null ) jcasType . jcas . throwFeatMissing ( "language" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_language ) ; }
getter for language - gets The language of the document O
20,750
public void setLanguage ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_language == null ) jcasType . jcas . throwFeatMissing ( "language" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_language , v ) ; }
setter for language - sets The language of the document O
20,751
public String getDoi ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_doi == null ) jcasType . jcas . throwFeatMissing ( "doi" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_doi ) ; }
getter for doi - gets document object identifier
20,752
public void setDoi ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_doi == null ) jcasType . jcas . throwFeatMissing ( "doi" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_doi , v ) ; }
setter for doi - sets document object identifier
20,753
public int getDocumentFrequency ( Token token ) { Integer df = ( Integer ) documentFrequency . get ( token ) ; if ( df == null ) return 0 ; else return df . intValue ( ) ; }
Get the document frequency of the token .
20,754
public void setGender ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_gender == null ) jcasType . jcas . throwFeatMissing ( "gender" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_gender , v ) ; }
setter for gender - sets Gender
20,755
public String getCase ( ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_case == null ) jcasType . jcas . throwFeatMissing ( "case" , "de.julielab.jules.types.PronounFeats" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_case ) ; }
getter for case - gets Case
20,756
public void setCase ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_case == null ) jcasType . jcas . throwFeatMissing ( "case" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_case , v ) ; }
setter for case - sets Case
20,757
public String getNumber ( ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_number == null ) jcasType . jcas . throwFeatMissing ( "number" , "de.julielab.jules.types.PronounFeats" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_number ) ; }
getter for number - gets Number
20,758
public void setNumber ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_number == null ) jcasType . jcas . throwFeatMissing ( "number" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_number , v ) ; }
setter for number - sets Number
20,759
public java . util . List < Object > getHeaders ( ) { if ( headers == null ) { headers = new ArrayList < Object > ( ) ; } return this . headers ; }
Gets the value of the headers property .
20,760
public String getComponentId ( ) { if ( Annotation_Type . featOkTst && ( ( Annotation_Type ) jcasType ) . casFeat_componentId == null ) jcasType . jcas . throwFeatMissing ( "componentId" , "de.julielab.jules.types.Annotation" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Annotation_Type ) jcasType ) . casFeatCode_componentId ) ; }
getter for componentId - gets Indicates which NLP component has been used to derive the annotation C
20,761
public void setComponentId ( String v ) { if ( Annotation_Type . featOkTst && ( ( Annotation_Type ) jcasType ) . casFeat_componentId == null ) jcasType . jcas . throwFeatMissing ( "componentId" , "de.julielab.jules.types.Annotation" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Annotation_Type ) jcasType ) . casFeatCode_componentId , v ) ; }
setter for componentId - sets Indicates which NLP component has been used to derive the annotation C
20,762
public void add ( String text , MentionType type ) { MentionType previousType = entities . add ( process ( text ) , type ) ; if ( previousType != null && ! previousType . equals ( type ) ) throw new IllegalArgumentException ( "Text is already associated with a different tag: " + text ) ; }
Adds a single entry to the dictionary . The text is processed by the tokenizer and the resulting tokens are stored .
20,763
public void toFrequencyFile ( String filePath ) throws IOException { BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( filePath ) , "UTF-8" ) ) ; for ( TrieNodeCnt child : root . children . values ( ) ) { child . writeFrequencies ( writer , new char [ 0 ] ) ; } writer . close ( ) ; }
one entry per line . word first then tab then frequency
20,764
public FSArray getNames ( ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) ) ) ; }
getter for names - gets
20,765
public void setNames ( FSArray v ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for names - sets
20,766
public Name getNames ( int i ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ; return ( Name ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ) ) ; }
indexed getter for names - gets an indexed value -
20,767
public void setNames ( int i , Name v ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for names - sets an indexed value -
20,768
private boolean judgeHTMLCode ( ArrayList < ArrayList < TextPiece > > wordsByPage ) { ArrayList < TextPiece > wordsOfPageOne = wordsByPage . get ( 0 ) ; boolean isHTMLCode = true ; int i = 0 ; while ( i < Math . min ( 20 , wordsOfPageOne . size ( ) ) ) { TextPiece currentWord = wordsOfPageOne . get ( i ) ; String thisText = currentWord . getText ( ) ; if ( ( thisText . length ( ) % 2 != 0 ) && ( thisText . matches ( "([A-Z]([A-Z]|[0-9]))*" ) == false ) ) { isHTMLCode = false ; break ; } i ++ ; } return isHTMLCode ; }
Detects documents encoded in HTML code
20,769
private void extractFiguresFromAPage ( ArrayList < TextPiece > linesOfAPage , ArrayList < TextPiece > wordsOfAPage , int i , File pdfFile , ArrayList < ArrayList < TextPiece > > linesByPage ) { if ( linesOfAPage . size ( ) > 30 ) { boolean figureKwdExist = false ; int prevTableEndIndex = 0 ; int k = - 1 ; for ( TextPiece t : linesOfAPage ) { k ++ ; String textWithoutSpace = t . getText ( ) . replace ( " " , "" ) ; TextPiece prevLine = ( k == 0 ) ? null : linesOfAPage . get ( k - 1 ) ; if ( getMatchedFigureKeyword ( textWithoutSpace ) != null ) { figureKwdExist = true ; String figKwd = getMatchedFigureKeyword ( textWithoutSpace ) ; System . out . println ( "In page " + ( i + 1 ) + ": " + textWithoutSpace ) ; } } } else { } }
Extracts figures from ONE page
20,770
private int extractOneTable ( int lineNumber , ArrayList < TextPiece > linesOfAPage , String keyword , TableCandidate tc , ArrayList < TextPiece > wordsOfAPage , int i , int prevTableEndIndex , ArrayList < ArrayList < TextPiece > > linesByPage ) { TextPiece line = linesOfAPage . get ( lineNumber ) ; if ( line . getX ( ) < 0 && line . getWidth ( ) == 0.0 ) { System . out . println ( "\n This is a reversed table, currently we do not support such tables!" ) ; lineNumber ++ ; tc . setValid ( false ) ; } else { lineNumber = findCaptionBoundary ( lineNumber , linesOfAPage , tc ) ; if ( tc . isValid ( ) ) { tc . setPageId_thisTable ( i ) ; isWideTable ( tc ) ; Vector distinctY = new Vector ( ) ; Vector piecesEachY = new Vector ( ) ; distinctY = getDistinctSortedY ( distinctY , piecesEachY , wordsOfAPage , tc ) ; boolean aboveCaption = judgeCaptionLocation ( linesOfAPage , tc , distinctY , wordsOfAPage ) ; lineNumber = findBodyBoundary ( lineNumber , linesOfAPage , tc , aboveCaption , prevTableEndIndex ) ; getReferenceTableTexts ( tc , linesByPage ) ; } tc . setHighLevelMeta ( i ) ; if ( tc . isValid ( ) ) { organizeCells ( linesOfAPage , tc ) ; } if ( tc . isValid ( ) ) { findFootnoteBeginRow ( tc ) ; } if ( tc . isValid ( ) ) { determineFootnoteHeading ( tc ) ; getColumnBoundaryWithoutHeading ( tc ) ; } int cc = tc . getColumnNum_thisTable ( ) ; if ( cc > 20 ) { tc . setValid ( false ) ; } else { if ( cc >= 2 ) { getTableStructure ( cc , tc , wordsOfAPage ) ; } else { tc . setEmptyMetadataStructureLevel ( tc . getRows ( ) . size ( ) , cc , wordsOfAPage , m_docInfo ) ; } } } return lineNumber ; }
Extracts a table if detecting a potential table caption
20,771
private void isWideTable ( TableCandidate tc ) { float docWidth = m_docInfo . getMaxX ( ) - m_docInfo . getMinX ( ) ; if ( ( ( ( tc . getCaptionX ( ) > ( ( docWidth - 30 ) / ( float ) 4.0 ) + m_docInfo . getMinX ( ) ) ) && ( tc . getCaptionX ( ) < docWidth / 2.5 ) ) || ( tc . getCaptonEndX ( ) - tc . getCaptionX ( ) > docWidth / ( float ) 1.85 ) ) { tc . setWideTable ( true ) ; } else { } }
Judges whether a table is a wide table or not by considering the width of the table
20,772
private void organizeCells ( ArrayList < TextPiece > linesOfAPage , TableCandidate tc ) { float captionY = linesOfAPage . get ( tc . getCaptionStartLine ( ) ) . getY ( ) ; float captionEndY = linesOfAPage . get ( tc . getCaptionEndLine ( ) ) . getEndY ( ) ; ArrayList < TextPiece > rawCells = new ArrayList < TextPiece > ( ) ; for ( int i = tc . getBodyStartLine ( ) ; i <= tc . getBodyEndLine ( ) ; i ++ ) { rawCells . add ( linesOfAPage . get ( i ) ) ; } Collections . sort ( rawCells ) ; assert rawCells . size ( ) >= 4 ; TableRow currentRow = null ; for ( TextPiece cell : rawCells ) { if ( tc . isTopCaption ( ) && ( cell . getY ( ) < captionY ) ) continue ; if ( ! tc . isTopCaption ( ) && ( cell . getEndY ( ) > captionEndY ) ) continue ; if ( currentRow != null && cell . getY ( ) - currentRow . getY ( ) < m_docInfo . getAverageLineGap ( ) / 2.0 ) currentRow . addCell ( cell ) ; else { currentRow = new TableRow ( ) ; currentRow . setY ( cell . getY ( ) ) ; if ( cell . isSuperScriptBeginning ( ) ) currentRow . setSuperScriptRow ( true ) ; currentRow . addCell ( cell ) ; tc . addRow ( currentRow ) ; } } if ( tc . getRows ( ) . size ( ) < 2 ) tc . setValid ( false ) ; }
Organizes cells into rows based on the coordinate information
20,773
public void getRowHeadingBasedOnCells ( TableCandidate tc ) { String rowHeadingThisTable = "" ; int footnoteLineIndex = tc . getFootnoteBeginRow ( ) ; String [ ] [ ] cells = tc . getCells ( ) ; for ( int j = 0 ; j < footnoteLineIndex ; j ++ ) { if ( cells [ j ] [ 0 ] . length ( ) > 0 ) rowHeadingThisTable = rowHeadingThisTable + cells [ j ] [ 0 ] + "; " ; } rowHeadingThisTable = tc . replaceAllSpecialChracters ( rowHeadingThisTable ) ; tc . setHeadingRows ( rowHeadingThisTable ) ; }
Get the table row headings based on the cell information
20,774
public String getDeptype ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_deptype == null ) jcasType . jcas . throwFeatMissing ( "deptype" , "com.digitalpebble.rasp.Dependency" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_deptype ) ; }
getter for deptype - gets
20,775
public void setDeptype ( String v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_deptype == null ) jcasType . jcas . throwFeatMissing ( "deptype" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_deptype , v ) ; }
setter for deptype - sets
20,776
public String getSubtype ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_subtype == null ) jcasType . jcas . throwFeatMissing ( "subtype" , "com.digitalpebble.rasp.Dependency" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_subtype ) ; }
getter for subtype - gets
20,777
public void setSubtype ( String v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_subtype == null ) jcasType . jcas . throwFeatMissing ( "subtype" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_subtype , v ) ; }
setter for subtype - sets
20,778
public WordForm getDep ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_dep == null ) jcasType . jcas . throwFeatMissing ( "dep" , "com.digitalpebble.rasp.Dependency" ) ; return ( WordForm ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_dep ) ) ) ; }
getter for dep - gets
20,779
public void setDep ( WordForm v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_dep == null ) jcasType . jcas . throwFeatMissing ( "dep" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_dep , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for dep - sets
20,780
public void setValue ( String v ) { if ( Lemma_Type . featOkTst && ( ( Lemma_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.Lemma" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Lemma_Type ) jcasType ) . casFeatCode_value , v ) ; }
setter for value - sets The value of lemma C
20,781
protected boolean trainCorpus ( List < List < Acronym > > corpus , List < Map < String , String > > trueLabels ) { boolean converge = false ; trueLabels = null ; initModelParamsAndCounters ( ) ; int n = corpus . size ( ) ; int c = 1 ; Double change ; LOG . debug ( "Training abbreviations..." ) ; while ( ! converge ) { for ( int i = 0 ; i < n ; i ++ ) { List < Acronym > docAcronyms = corpus . get ( i ) ; Map < String , String > docTrueLabels = null ; if ( trueLabels != null ) docTrueLabels = trueLabels . get ( i ) ; int m = docAcronyms . size ( ) ; for ( int j = 0 ; j < m ; j ++ ) { Acronym currAcronym = docAcronyms . get ( j ) ; if ( trueLabels != null ) expectationStep ( currAcronym , docTrueLabels . get ( currAcronym . _shortForm ) ) ; else expectationStep ( currAcronym , null ) ; } } change = maximizationStep ( ) ; LOG . debug ( "step {}..." , c ) ; c ++ ; if ( c > MAX_ITERATIONS ) { System . out . println ( "\n\tTraining stopped after " + ( c - 1 ) + " iterations with final change: " + change ) ; converge = true ; } if ( change . compareTo ( CHANGE_THRESHOLD ) < 0 ) { LOG . debug ( "Training converged in " + ( c - 1 ) + " iterations." ) ; converge = true ; } } saveModelParams ( ) ; return true ; }
Gets training examples separated by documents
20,782
public String remove ( String txt ) { for ( Pattern p : patterns . keySet ( ) ) { System . out . println ( "p: " + p ) ; System . out . println ( "b: " + txt ) ; txt = p . matcher ( txt ) . replaceAll ( patterns . get ( p ) ) ; System . out . println ( "a: " + txt ) ; } return txt ; }
Takes a string and returns it without ligatures in it
20,783
public FSArray getValue ( ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) ) ) ; }
getter for value - gets Annotations to be chained .
20,784
public void setValue ( FSArray v ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for value - sets Annotations to be chained .
20,785
public Annotation getValue ( int i ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ) ) ; }
indexed getter for value - gets an indexed value - Annotations to be chained .
20,786
public void setValue ( int i , Annotation v ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
indexed setter for value - sets an indexed value - Annotations to be chained .
20,787
public int getDocumentSize ( ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_documentSize == null ) jcasType . jcas . throwFeatMissing ( "documentSize" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_documentSize ) ; }
getter for documentSize - gets Size of original document in bytes before processing by CAS Initializer . Either absolute file size of size within file or other source .
20,788
public void setDocumentSize ( int v ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_documentSize == null ) jcasType . jcas . throwFeatMissing ( "documentSize" , "org.apache.uima.examples.SourceDocumentInformation" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_documentSize , v ) ; }
setter for documentSize - sets Size of original document in bytes before processing by CAS Initializer . Either absolute file size of size within file or other source .
20,789
public boolean getLastSegment ( ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_lastSegment ) ; }
getter for lastSegment - gets For a CAS that represents a segment of a larger source document this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document .
20,790
public void setLastSegment ( boolean v ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_lastSegment , v ) ; }
setter for lastSegment - sets For a CAS that represents a segment of a larger source document this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document .
20,791
public String getLemma ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_lemma ) ; }
getter for lemma - gets lemma of the Form
20,792
public void setLemma ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_lemma , v ) ; }
setter for lemma - sets lemma of the Form
20,793
public String getPOS ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_POS == null ) jcasType . jcas . throwFeatMissing ( "POS" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_POS ) ; }
getter for POS - gets POS tag for a given form
20,794
public void setPOS ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_POS == null ) jcasType . jcas . throwFeatMissing ( "POS" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_POS , v ) ; }
setter for POS - sets POS tag for a given form
20,795
public String getSuffix ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_suffix == null ) jcasType . jcas . throwFeatMissing ( "suffix" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_suffix ) ; }
getter for suffix - gets
20,796
public void setSuffix ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_suffix == null ) jcasType . jcas . throwFeatMissing ( "suffix" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_suffix , v ) ; }
setter for suffix - sets
20,797
public static void serializeXMLDocument ( Document doc , Writer output ) throws TransformerException { Transformer trans = TransformerFactory . newInstance ( ) . newTransformer ( ) ; DOMSource source = new DOMSource ( doc ) ; StreamResult result = new StreamResult ( output ) ; trans . transform ( source , result ) ; }
Writes the given Document to the given Writer using a no - op XSL transformation .
20,798
private FeatureIndex [ ] createFeatureIndex ( int subspaceCount ) { logger . info ( "create feature index" ) ; FeatureIndex [ ] index = new FeatureIndex [ subspaceCount ] ; for ( int i = 0 ; i < subspaceCount ; i ++ ) index [ i ] = new FeatureIndex ( false , 1 ) ; return index ; }
create feature index
20,799
private static String annotatateContent ( JCas jcas , Object contentObj , int start ) { LOG . trace ( "annotate: " + reflectionToString ( contentObj ) ) ; int end = start ; StringBuilder internalSb = new StringBuilder ( ) ; if ( contentObj instanceof String ) { String c = ( String ) contentObj ; internalSb . append ( c ) ; end += c . length ( ) ; } else if ( contentObj instanceof Cons ) { Cons cons = ( Cons ) contentObj ; for ( Object o : cons . getContent ( ) ) { String parse = annotatateContent ( jcas , o , end ) ; end += parse . length ( ) ; internalSb . append ( parse ) ; } BioEntityMention entity = new BioEntityMention ( jcas , start , end ) ; entity . setSpecificType ( cons . getSem ( ) ) ; entity . setComponentId ( GeniaCorpusCollectionReader . COMPONENT_ID ) ; entity . setTextualRepresentation ( cons . getLex ( ) ) ; entity . addToIndexes ( ) ; } return internalSb . toString ( ) ; }
Recursive since annotations can overlap