idx
int64
0
165k
question
stringlengths
73
4.15k
target
stringlengths
5
918
len_question
int64
21
890
len_target
int64
3
255
20,500
public Instance getInstance ( String src , int j ) { return ( Instance ) ( ( ArrayList ) sourceLists . get ( src ) ) . get ( j ) ; }
Get the j - th record for the named source .
39
11
20,501
public static String maxTruncStr ( String source , int maxNrChars ) { if ( source != null && source . length ( ) > maxNrChars ) { return source . substring ( 0 , maxNrChars ) ; } else { return source ; } }
Truncates the String at maxNrChars .
61
12
20,502
public double score ( StringWrapper s , StringWrapper t ) { String S = s . unwrap ( ) , T = t . unwrap ( ) ; totalScore = 0.0 ; if ( S . equals ( T ) ) { matched = S . length ( ) ; return 1.0 ; } else { sSize = S . length ( ) ; tSize = T . length ( ) ; // let S be the largest token if ( sSize < tSize ) { String tmp1 = S ; S = T ; T = tmp1 ; double tmp2 = sSize ; sSize = tSize ; tSize = tmp2 ; tokenT = T ; } tokenT = S ; ArrayList candidateList = algorithm1 ( S , T ) ; sortList ( candidateList ) ; totalScore = getScore ( candidateList ) ; totalScore = ( totalScore / ( ( double ) sSize ) + totalScore / ( ( double ) tSize ) ) / 2.0 ; return winkler ( totalScore , S , T ) ; } }
score return the a strng distance value between 0 and 1 of a pair of tokens . Where 1 is the maximum similarity .
221
25
20,503
public String explainScore ( StringWrapper s , StringWrapper t ) { String S = s . unwrap ( ) , T = t . unwrap ( ) ; StringBuffer buff = new StringBuffer ( ) ; buff . append ( "\n****TagLinkToken****\n" ) ; buff . append ( "Si=" + S + ", Tj=" + T + "\n" ) ; double totalScore = 0.0 ; if ( S . equals ( T ) ) { matched = S . length ( ) ; buff . append ( "Sij=1.0" ) ; } else { sSize = S . length ( ) ; tSize = T . length ( ) ; // let S be the biggest token if ( sSize < tSize ) { String tmp1 = S ; S = T ; T = tmp1 ; double tmp2 = sSize ; sSize = tSize ; tSize = tmp2 ; } ArrayList candidateList = algorithm1 ( S , T ) ; sortList ( candidateList ) ; buff . append ( "Common characteres:\n" ) ; buff . append ( "Si\tTj\tScore_ij(Si,Tj)\n" ) ; matched = 0 ; HashMap tMap = new HashMap ( ) , uMap = new HashMap ( ) ; java . util . Iterator it = candidateList . iterator ( ) ; while ( it . hasNext ( ) ) { TagLink . Candidates actualCandidates = ( TagLink . Candidates ) it . next ( ) ; Integer sPos = new Integer ( actualCandidates . getTPos ( ) ) , tPos = new Integer ( actualCandidates . getUPos ( ) ) ; if ( ( ! tMap . containsKey ( sPos ) ) && ( ! uMap . containsKey ( tPos ) ) ) { double actualScore = actualCandidates . getScore ( ) ; totalScore += actualScore ; tMap . put ( sPos , null ) ; uMap . put ( tPos , null ) ; buff . append ( S . charAt ( sPos . intValue ( ) ) + "\t" + T . charAt ( tPos . intValue ( ) ) + "\t" + round ( actualScore ) + "\n" ) ; matched ++ ; } } totalScore = ( totalScore / ( ( double ) sSize ) + totalScore / ( ( double ) tSize ) ) / 2.0 ; System . out . println ( "score " + totalScore ) ; buff . append ( "Score_ij(S,T)=" + round ( winkler ( totalScore , S , T ) ) ) ; buff . append ( "\nMatched characters=" + matched ) ; } return buff . toString ( ) ; }
explainScore returns an explanation of how the string distance was computed .
585
14
20,504
private double getScore ( ArrayList candidateList ) { matched = 0 ; largestIndex = - 1 ; double scoreValue = 0 ; HashMap tMap = new HashMap ( ) , uMap = new HashMap ( ) ; java . util . Iterator it = candidateList . iterator ( ) ; while ( it . hasNext ( ) ) { TagLink . Candidates actualCandidates = ( TagLink . Candidates ) it . next ( ) ; Integer actualTPos = new Integer ( actualCandidates . getTPos ( ) ) , actualUPos = new Integer ( actualCandidates . getUPos ( ) ) ; if ( ( ! tMap . containsKey ( actualTPos ) ) && ( ! uMap . containsKey ( actualUPos ) ) ) { double actualScore = actualCandidates . getScore ( ) ; scoreValue += actualScore ; tMap . put ( actualTPos , null ) ; uMap . put ( actualUPos , null ) ; if ( largestIndex < actualTPos . intValue ( ) ) { largestIndex = actualTPos . intValue ( ) ; } matched ++ ; } } return scoreValue ; }
getScore sum the total score of a candidate list of pair of characters .
243
15
20,505
private ArrayList algorithm1 ( String S , String T ) { ArrayList candidateList = new ArrayList ( ) ; int bound = ( int ) ( 1.0 / tr ) ; for ( int t = 0 ; t < S . length ( ) ; t ++ ) { char chT = S . charAt ( t ) ; double lastTr = - 1 ; for ( int u = Math . max ( 0 , t - bound ) , flag = 0 ; u < Math . min ( t + bound + 1 , T . length ( ) ) && flag == 0 ; u ++ ) { double tr2 = ( ( double ) Math . abs ( t - u ) ) ; if ( ( lastTr >= 0.0 ) && ( lastTr < tr2 ) ) { flag = 1 ; } else { char chU = T . charAt ( u ) ; double charScore = 0.0 ; if ( chT == chU ) { charScore = 1.0 ; } if ( charScore > 0.0 ) { if ( charScore == 1.0 ) { lastTr = tr2 ; } charScore = charScore - ( tr * tr2 ) ; if ( charScore == 1.0 ) { flag = 1 ; } candidateList . add ( new TagLink . Candidates ( t , u , charScore ) ) ; } } } } return candidateList ; }
algorithm1 select the considered most appropiate character pairs are return a list of candidates .
290
19
20,506
private void sortList ( ArrayList candidateList ) { java . util . Collections . sort ( candidateList , new java . util . Comparator ( ) { public int compare ( Object o1 , Object o2 ) { double scoreT = ( ( TagLink . Candidates ) o1 ) . getScore ( ) ; double scoreU = ( ( TagLink . Candidates ) o2 ) . getScore ( ) ; if ( scoreU > scoreT ) { return 1 ; } if ( scoreU > scoreT ) { return - 1 ; } return 0 ; } } ) ; }
sortList sort a candidate list by its scores .
122
10
20,507
private double winkler ( double totalScore , String S , String T ) { totalScore = totalScore + ( getPrefix ( S , T ) * 0.1 * ( 1.0 - totalScore ) ) ; return totalScore ; }
winkler scorer . Compute the Winkler heuristic as in Winkler 1999 .
51
18
20,508
public String getStyleName ( ) { if ( Style_Type . featOkTst && ( ( Style_Type ) jcasType ) . casFeat_styleName == null ) jcasType . jcas . throwFeatMissing ( "styleName" , "de.julielab.jules.types.Style" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Style_Type ) jcasType ) . casFeatCode_styleName ) ; }
getter for styleName - gets the name of the style used .
111
14
20,509
public void setStyleName ( String v ) { if ( Style_Type . featOkTst && ( ( Style_Type ) jcasType ) . casFeat_styleName == null ) jcasType . jcas . throwFeatMissing ( "styleName" , "de.julielab.jules.types.Style" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Style_Type ) jcasType ) . casFeatCode_styleName , v ) ; }
setter for styleName - sets the name of the style used .
114
14
20,510
@ Override public int compareTo ( BLine other ) { int pageCompare = new Integer ( pageId ) . compareTo ( other . pageId ) ; if ( pageCompare != 0 ) { return pageCompare ; } int xCompare = new Float ( region . x ) . compareTo ( other . region . x ) ; if ( xCompare != 0 ) { return xCompare ; } int yCompare = new Float ( region . y ) . compareTo ( other . region . y ) ; return yCompare ; }
compare by page x y
108
6
20,511
public final double [ ] eval ( String [ ] context , double [ ] outsums ) { int [ ] activeOutcomes ; double [ ] activeParameters ; for ( int oid = 0 ; oid < numOutcomes ; oid ++ ) { outsums [ oid ] = iprob ; numfeats [ oid ] = 0 ; } for ( int i = 0 ; i < context . length ; i ++ ) { int contextIndex = pmap . get ( context [ i ] ) ; if ( contextIndex >= 0 ) { Context predParams = params [ contextIndex ] ; activeOutcomes = predParams . getOutcomes ( ) ; activeParameters = predParams . getParameters ( ) ; for ( int j = 0 ; j < activeOutcomes . length ; j ++ ) { int oid = activeOutcomes [ j ] ; numfeats [ oid ] ++ ; outsums [ oid ] += activeParameters [ j ] ; } } } double normal = 0.0 ; for ( int oid = 0 ; oid < numOutcomes ; oid ++ ) { outsums [ oid ] = Math . exp ( ( outsums [ oid ] * fval ) + ( ( 1.0 - ( numfeats [ oid ] / correctionConstant ) ) * correctionParam ) ) ; normal += outsums [ oid ] ; } for ( int oid = 0 ; oid < numOutcomes ; oid ++ ) outsums [ oid ] /= normal ; return outsums ; }
Use this model to evaluate a context and return an array of the likelihood of each outcome given that context .
325
21
20,512
public final String getBestOutcome ( double [ ] ocs ) { int best = 0 ; for ( int i = 1 ; i < ocs . length ; i ++ ) if ( ocs [ i ] > ocs [ best ] ) best = i ; return ocNames [ best ] ; }
Return the name of the outcome corresponding to the highest likelihood in the parameter ocs .
64
17
20,513
public int getIndex ( String outcome ) { for ( int i = 0 ; i < ocNames . length ; i ++ ) { if ( ocNames [ i ] . equals ( outcome ) ) return i ; } return - 1 ; }
Gets the index associated with the String name of the given outcome .
51
14
20,514
public static String extractText ( Article article ) { StringBuilder sb = new StringBuilder ( ) ; // extract abstract List < Abstract > abstracts = article . getFront ( ) . getArticleMeta ( ) . getAbstract ( ) ; for ( Abstract abstrct : abstracts ) { for ( Sec sec : abstrct . getSec ( ) ) { processTextContent ( sec . getAddressOrAlternativesOrArray ( ) , sb , true ) ; } } sb . append ( ' ' ) ; // extract text Body body = article . getBody ( ) ; if ( body != null ) { for ( Sec sec : body . getSec ( ) ) { Title title = sec . getTitle ( ) ; if ( title != null && title . getContent ( ) != null ) { processTextContent ( title . getContent ( ) , sb , true ) ; sb . append ( ' ' ) ; } processTextContent ( sec . getAddressOrAlternativesOrArray ( ) , sb , false ) ; } } return removeNoise ( sb . toString ( ) ) ; }
Iterates recursively over all objects of this article and tries to extract its text
233
17
20,515
private static String removeNoise ( String s ) { return s . replace ( " " , " " ) . replace ( " " , " " ) // // caused by omitting xref tags . replace ( " , " , " " ) . replace ( " ( )" , "" ) // . replace ( "&#x000a0;" , " " ) . replace ( " ", ") / / nbsp . replace ( "[ – ]", " "). r e place(" [ ]", " ); / / }
removing noise could be improved ...
109
7
20,516
public java . util . List < Object > getContent ( ) { if ( content == null ) { content = new ArrayList < Object > ( ) ; } return this . content ; }
Gets the value of the content property .
39
9
20,517
public String getSemtype ( ) { if ( SurfaceForm_Type . featOkTst && ( ( SurfaceForm_Type ) jcasType ) . casFeat_semtype == null ) jcasType . jcas . throwFeatMissing ( "semtype" , "ch.epfl.bbp.uima.types.SurfaceForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( SurfaceForm_Type ) jcasType ) . casFeatCode_semtype ) ; }
getter for semtype - gets
117
7
20,518
public void setSemtype ( String v ) { if ( SurfaceForm_Type . featOkTst && ( ( SurfaceForm_Type ) jcasType ) . casFeat_semtype == null ) jcasType . jcas . throwFeatMissing ( "semtype" , "ch.epfl.bbp.uima.types.SurfaceForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( SurfaceForm_Type ) jcasType ) . casFeatCode_semtype , v ) ; }
setter for semtype - sets
120
7
20,519
public String [ ] getContext ( Object o ) { String s = ( String ) o ; int prevIndex = - 1 ; int index = s . indexOf ( ' ' ) ; List cuts = new ArrayList ( ) ; while ( index != - 1 ) { cuts . add ( s . substring ( prevIndex + 1 , index ) ) ; prevIndex = index ; index = s . indexOf ( ' ' , ++ index ) ; } cuts . add ( s . substring ( prevIndex + 1 , s . length ( ) ) ) ; return ( String [ ] ) cuts . toArray ( new String [ cuts . size ( ) ] ) ; }
Builds up the list of contextual predicates given a String .
138
13
20,520
public RegulationOfGeneExpression getRelation ( ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_relation == null ) jcasType . jcas . throwFeatMissing ( "relation" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; return ( RegulationOfGeneExpression ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_relation ) ) ) ; }
getter for relation - gets mention of gene regulation relation
153
11
20,521
public void setRelation ( RegulationOfGeneExpression v ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_relation == null ) jcasType . jcas . throwFeatMissing ( "relation" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_relation , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for relation - sets mention of gene regulation relation
146
11
20,522
public Chemicals getLigand ( ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_ligand == null ) jcasType . jcas . throwFeatMissing ( "ligand" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; return ( Chemicals ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_ligand ) ) ) ; }
getter for ligand - gets chemical particpating in the gene regulation process
151
16
20,523
public void setLigand ( Chemicals v ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_ligand == null ) jcasType . jcas . throwFeatMissing ( "ligand" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_ligand , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for ligand - sets chemical particpating in the gene regulation process
147
16
20,524
public CellGrowthCondition getCellGrowthCondition ( ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_cellGrowthCondition == null ) jcasType . jcas . throwFeatMissing ( "cellGrowthCondition" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; return ( CellGrowthCondition ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_cellGrowthCondition ) ) ) ; }
getter for cellGrowthCondition - gets cell growth condition
162
12
20,525
public void setCellGrowthCondition ( CellGrowthCondition v ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_cellGrowthCondition == null ) jcasType . jcas . throwFeatMissing ( "cellGrowthCondition" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_cellGrowthCondition , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for cellGrowthCondition - sets cell growth condition
156
12
20,526
public InvestigationTechnique getInvestigationTechnique ( ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_investigationTechnique == null ) jcasType . jcas . throwFeatMissing ( "investigationTechnique" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; return ( InvestigationTechnique ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_investigationTechnique ) ) ) ; }
getter for investigationTechnique - gets investigation technique for the detection of the gene regulation relation
160
18
20,527
public void setInvestigationTechnique ( InvestigationTechnique v ) { if ( GeneRegulationTemplate_Type . featOkTst && ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeat_investigationTechnique == null ) jcasType . jcas . throwFeatMissing ( "investigationTechnique" , "de.julielab.jules.types.bootstrep.GeneRegulationTemplate" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( GeneRegulationTemplate_Type ) jcasType ) . casFeatCode_investigationTechnique , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for investigationTechnique - sets investigation technique for the detection of the gene regulation relation
155
18
20,528
public Sentence filter ( Sentence sent ) { //logger.debug("\"" + Array.toString(sent) + "\""); int start = 0 , end = sent . length ( ) - 1 ; boolean b = false ; for ( int i = 0 ; i < sent . length ( ) ; i ++ ) { if ( sent . wordAt ( i ) . getRole ( ) . equals ( Word . AGENT_LABEL ) ) { start = i - getSize ( ) ; b = true ; break ; } } // end for i if ( ! b ) return null ; end = start + 2 * getSize ( ) + 1 ; if ( start < 0 ) start = 0 ; if ( end > sent . length ( ) ) end = sent . length ( ) ; return sent . fragment ( start , end ) ; }
context . verificare
177
5
20,529
public String getForeName ( ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_foreName == null ) jcasType . jcas . throwFeatMissing ( "foreName" , "de.julielab.jules.types.AuthorInfo" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_foreName ) ; }
getter for foreName - gets An authors forename
115
11
20,530
public void setForeName ( String v ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_foreName == null ) jcasType . jcas . throwFeatMissing ( "foreName" , "de.julielab.jules.types.AuthorInfo" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_foreName , v ) ; }
setter for foreName - sets An authors forename
118
11
20,531
public String getAffiliation ( ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_affiliation == null ) jcasType . jcas . throwFeatMissing ( "affiliation" , "de.julielab.jules.types.AuthorInfo" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_affiliation ) ; }
getter for affiliation - gets Affiliation of the author
115
11
20,532
public void setAffiliation ( String v ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_affiliation == null ) jcasType . jcas . throwFeatMissing ( "affiliation" , "de.julielab.jules.types.AuthorInfo" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_affiliation , v ) ; }
setter for affiliation - sets Affiliation of the author
118
11
20,533
public String getLastName ( ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_lastName == null ) jcasType . jcas . throwFeatMissing ( "lastName" , "de.julielab.jules.types.AuthorInfo" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_lastName ) ; }
getter for lastName - gets The last name of the author .
115
14
20,534
public void setLastName ( String v ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_lastName == null ) jcasType . jcas . throwFeatMissing ( "lastName" , "de.julielab.jules.types.AuthorInfo" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_lastName , v ) ; }
setter for lastName - sets The last name of the author .
118
14
20,535
public String getInitials ( ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_initials == null ) jcasType . jcas . throwFeatMissing ( "initials" , "de.julielab.jules.types.AuthorInfo" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_initials ) ; }
getter for initials - gets Initials
115
8
20,536
public void setInitials ( String v ) { if ( AuthorInfo_Type . featOkTst && ( ( AuthorInfo_Type ) jcasType ) . casFeat_initials == null ) jcasType . jcas . throwFeatMissing ( "initials" , "de.julielab.jules.types.AuthorInfo" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( AuthorInfo_Type ) jcasType ) . casFeatCode_initials , v ) ; }
setter for initials - sets Initials
118
8
20,537
public void add ( String outcome , double p ) { outcomes . add ( outcome ) ; probs . add ( new Double ( p ) ) ; score += Math . log ( p ) ; }
Adds an outcome and probability to this sequence .
40
9
20,538
public void getProbs ( double [ ] ps ) { for ( int pi = 0 , pl = probs . size ( ) ; pi < pl ; pi ++ ) { ps [ pi ] = ( ( Double ) probs . get ( pi ) ) . doubleValue ( ) ; } }
Populates an array with the probabilities associated with the outcomes of this sequece .
61
17
20,539
public LinkedList < Diff > diff_main ( String text1 , String text2 , boolean checklines ) { // Set a deadline by which time the diff must be complete. long deadline ; if ( Diff_Timeout <= 0 ) { deadline = Long . MAX_VALUE ; } else { deadline = System . currentTimeMillis ( ) + ( long ) ( Diff_Timeout * 1000 ) ; } return diff_main ( text1 , text2 , checklines , deadline ) ; }
Find the differences between two texts .
101
7
20,540
private LinkedList < Diff > diff_main ( String text1 , String text2 , boolean checklines , long deadline ) { // Check for null inputs. if ( text1 == null || text2 == null ) { throw new IllegalArgumentException ( "Null inputs. (diff_main)" ) ; } // Check for equality (speedup). LinkedList < Diff > diffs ; if ( text1 . equals ( text2 ) ) { diffs = new LinkedList < Diff > ( ) ; if ( text1 . length ( ) != 0 ) { diffs . add ( new Diff ( Operation . EQUAL , text1 ) ) ; } return diffs ; } // Trim off common prefix (speedup). int commonlength = diff_commonPrefix ( text1 , text2 ) ; String commonprefix = text1 . substring ( 0 , commonlength ) ; text1 = text1 . substring ( commonlength ) ; text2 = text2 . substring ( commonlength ) ; // Trim off common suffix (speedup). commonlength = diff_commonSuffix ( text1 , text2 ) ; String commonsuffix = text1 . substring ( text1 . length ( ) - commonlength ) ; text1 = text1 . substring ( 0 , text1 . length ( ) - commonlength ) ; text2 = text2 . substring ( 0 , text2 . length ( ) - commonlength ) ; // Compute the diff on the middle block. diffs = diff_compute ( text1 , text2 , checklines , deadline ) ; // Restore the prefix and suffix. if ( commonprefix . length ( ) != 0 ) { diffs . addFirst ( new Diff ( Operation . EQUAL , commonprefix ) ) ; } if ( commonsuffix . length ( ) != 0 ) { diffs . addLast ( new Diff ( Operation . EQUAL , commonsuffix ) ) ; } diff_cleanupMerge ( diffs ) ; return diffs ; }
Find the differences between two texts . Simplifies the problem by stripping any common prefix or suffix off the texts before diffing .
424
25
20,541
public String diff_prettyHtml ( LinkedList < Diff > diffs ) { StringBuilder html = new StringBuilder ( ) ; for ( Diff aDiff : diffs ) { String text = aDiff . text . replace ( "&" , "&amp;" ) . replace ( "<" , "&lt;" ) . replace ( ">" , "&gt;" ) . replace ( "\n" , "&para;<br>" ) ; switch ( aDiff . operation ) { case INSERT : html . append ( "<ins style=\"background:#e6ffe6;\">" ) . append ( text ) . append ( "</ins>" ) ; break ; case DELETE : html . append ( "<del style=\"background:#ffe6e6;\">" ) . append ( text ) . append ( "</del>" ) ; break ; case EQUAL : html . append ( "<span>" ) . append ( text ) . append ( "</span>" ) ; break ; } } return html . toString ( ) ; }
Convert a Diff list into a pretty HTML report .
220
11
20,542
public String diff_toDelta ( LinkedList < Diff > diffs ) { StringBuilder text = new StringBuilder ( ) ; for ( Diff aDiff : diffs ) { switch ( aDiff . operation ) { case INSERT : try { text . append ( "+" ) . append ( URLEncoder . encode ( aDiff . text , "UTF-8" ) . replace ( ' ' , ' ' ) ) . append ( "\t" ) ; } catch ( UnsupportedEncodingException e ) { // Not likely on modern system. throw new Error ( "This system does not support UTF-8." , e ) ; } break ; case DELETE : text . append ( "-" ) . append ( aDiff . text . length ( ) ) . append ( "\t" ) ; break ; case EQUAL : text . append ( "=" ) . append ( aDiff . text . length ( ) ) . append ( "\t" ) ; break ; } } String delta = text . toString ( ) ; if ( delta . length ( ) != 0 ) { // Strip off trailing tab character. delta = delta . substring ( 0 , delta . length ( ) - 1 ) ; delta = unescapeForEncodeUriCompatability ( delta ) ; } return delta ; }
Crush the diff into an encoded string which describes the operations required to transform text1 into text2 . E . g . = 3 \ t - 2 \ t + ing - > Keep 3 chars delete 2 chars insert ing . Operations are tab - separated . Inserted text is escaped using %xx notation .
271
62
20,543
public static int match_main ( String text , String pattern , int loc ) { // Check for null inputs. if ( text == null || pattern == null ) { throw new IllegalArgumentException ( "Null inputs. (match_main)" ) ; } loc = Math . max ( 0 , Math . min ( loc , text . length ( ) ) ) ; if ( text . equals ( pattern ) ) { // Shortcut (potentially not guaranteed by the algorithm) return 0 ; } else if ( text . length ( ) == 0 ) { // Nothing to match. return - 1 ; } else if ( loc + pattern . length ( ) <= text . length ( ) && text . substring ( loc , loc + pattern . length ( ) ) . equals ( pattern ) ) { // Perfect match at the perfect spot! (Includes case of null // pattern) return loc ; } else { // Do a fuzzy compare. return match_bitap ( text , pattern , loc ) ; } }
Locate the best instance of pattern in text near loc . Returns - 1 if no match found .
205
20
20,544
@ SuppressWarnings ( "unused" ) private static double match_bitapScore ( int e , int x , int loc , String pattern ) { float accuracy = ( float ) e / pattern . length ( ) ; int proximity = Math . abs ( loc - x ) ; if ( Match_Distance == 0 ) { // Dodge divide by zero error. return proximity == 0 ? accuracy : 1.0 ; } return accuracy + ( proximity / ( float ) Match_Distance ) ; }
Compute and return the score for a match with e errors and x location .
103
16
20,545
protected static Map < Character , Integer > match_alphabet ( String pattern ) { Map < Character , Integer > s = new HashMap < Character , Integer > ( ) ; char [ ] char_pattern = pattern . toCharArray ( ) ; for ( char c : char_pattern ) { s . put ( c , 0 ) ; } int i = 0 ; for ( char c : char_pattern ) { s . put ( c , s . get ( c ) | ( 1 << ( pattern . length ( ) - i - 1 ) ) ) ; i ++ ; } return s ; }
Initialise the alphabet for the Bitap algorithm .
124
10
20,546
protected void patch_addContext ( Patch patch , String text ) { if ( text . length ( ) == 0 ) { return ; } String pattern = text . substring ( patch . start2 , patch . start2 + patch . length1 ) ; int padding = 0 ; // Look for the first and last matches of pattern in text. If two // different // matches are found, increase the pattern length. while ( text . indexOf ( pattern ) != text . lastIndexOf ( pattern ) && pattern . length ( ) < Match_MaxBits - Patch_Margin - Patch_Margin ) { padding += Patch_Margin ; pattern = text . substring ( Math . max ( 0 , patch . start2 - padding ) , Math . min ( text . length ( ) , patch . start2 + patch . length1 + padding ) ) ; } // Add one chunk for good luck. padding += Patch_Margin ; // Add the prefix. String prefix = text . substring ( Math . max ( 0 , patch . start2 - padding ) , patch . start2 ) ; if ( prefix . length ( ) != 0 ) { patch . diffs . addFirst ( new Diff ( Operation . EQUAL , prefix ) ) ; } // Add the suffix. String suffix = text . substring ( patch . start2 + patch . length1 , Math . min ( text . length ( ) , patch . start2 + patch . length1 + padding ) ) ; if ( suffix . length ( ) != 0 ) { patch . diffs . addLast ( new Diff ( Operation . EQUAL , suffix ) ) ; } // Roll back the start points. patch . start1 -= prefix . length ( ) ; patch . start2 -= prefix . length ( ) ; // Extend the lengths. patch . length1 += prefix . length ( ) + suffix . length ( ) ; patch . length2 += prefix . length ( ) + suffix . length ( ) ; }
Increase the context until it is unique but don t let the pattern expand beyond Match_MaxBits .
407
21
20,547
public LinkedList < Patch > patch_make ( String text1 , String text2 ) { if ( text1 == null || text2 == null ) { throw new IllegalArgumentException ( "Null inputs. (patch_make)" ) ; } // No diffs provided, compute our own. LinkedList < Diff > diffs = diff_main ( text1 , text2 , true ) ; if ( diffs . size ( ) > 2 ) { diff_cleanupSemantic ( diffs ) ; diff_cleanupEfficiency ( diffs ) ; } return patch_make ( text1 , diffs ) ; }
Compute a list of patches to turn text1 into text2 . A set of diffs will be computed .
132
23
20,548
public LinkedList < Patch > patch_make ( LinkedList < Diff > diffs ) { if ( diffs == null ) { throw new IllegalArgumentException ( "Null inputs. (patch_make)" ) ; } // No origin string provided, compute our own. String text1 = diff_text1 ( diffs ) ; return patch_make ( text1 , diffs ) ; }
Compute a list of patches to turn text1 into text2 . text1 will be derived from the provided diffs .
84
25
20,549
public LinkedList < Patch > patch_make ( String text1 , String text2 , LinkedList < Diff > diffs ) { return patch_make ( text1 , diffs ) ; }
Compute a list of patches to turn text1 into text2 . text2 is ignored diffs are the delta between text1 and text2 .
42
30
20,550
public LinkedList < Patch > patch_deepCopy ( LinkedList < Patch > patches ) { LinkedList < Patch > patchesCopy = new LinkedList < Patch > ( ) ; for ( Patch aPatch : patches ) { Patch patchCopy = new Patch ( ) ; for ( Diff aDiff : aPatch . diffs ) { Diff diffCopy = new Diff ( aDiff . operation , aDiff . text ) ; patchCopy . diffs . add ( diffCopy ) ; } patchCopy . start1 = aPatch . start1 ; patchCopy . start2 = aPatch . start2 ; patchCopy . length1 = aPatch . length1 ; patchCopy . length2 = aPatch . length2 ; patchesCopy . add ( patchCopy ) ; } return patchesCopy ; }
Given an array of patches return another array that is identical .
165
12
20,551
public String patch_addPadding ( LinkedList < Patch > patches ) { short paddingLength = Patch_Margin ; String nullPadding = "" ; for ( short x = 1 ; x <= paddingLength ; x ++ ) { nullPadding += String . valueOf ( ( char ) x ) ; } // Bump all the patches forward. for ( Patch aPatch : patches ) { aPatch . start1 += paddingLength ; aPatch . start2 += paddingLength ; } // Add some padding on start of first diff. Patch patch = patches . getFirst ( ) ; LinkedList < Diff > diffs = patch . diffs ; if ( diffs . isEmpty ( ) || diffs . getFirst ( ) . operation != Operation . EQUAL ) { // Add nullPadding equality. diffs . addFirst ( new Diff ( Operation . EQUAL , nullPadding ) ) ; patch . start1 -= paddingLength ; // Should be 0. patch . start2 -= paddingLength ; // Should be 0. patch . length1 += paddingLength ; patch . length2 += paddingLength ; } else if ( paddingLength > diffs . getFirst ( ) . text . length ( ) ) { // Grow first equality. Diff firstDiff = diffs . getFirst ( ) ; int extraLength = paddingLength - firstDiff . text . length ( ) ; firstDiff . text = nullPadding . substring ( firstDiff . text . length ( ) ) + firstDiff . text ; patch . start1 -= extraLength ; patch . start2 -= extraLength ; patch . length1 += extraLength ; patch . length2 += extraLength ; } // Add some padding on end of last diff. patch = patches . getLast ( ) ; diffs = patch . diffs ; if ( diffs . isEmpty ( ) || diffs . getLast ( ) . operation != Operation . EQUAL ) { // Add nullPadding equality. diffs . addLast ( new Diff ( Operation . EQUAL , nullPadding ) ) ; patch . length1 += paddingLength ; patch . length2 += paddingLength ; } else if ( paddingLength > diffs . getLast ( ) . text . length ( ) ) { // Grow last equality. Diff lastDiff = diffs . getLast ( ) ; int extraLength = paddingLength - lastDiff . text . length ( ) ; lastDiff . text += nullPadding . substring ( 0 , extraLength ) ; patch . length1 += extraLength ; patch . length2 += extraLength ; } return nullPadding ; }
Add some padding on text start and end so that edges can match something . Intended to be called only from within patch_apply .
537
27
20,552
public String patch_toText ( List < Patch > patches ) { StringBuilder text = new StringBuilder ( ) ; for ( Patch aPatch : patches ) { text . append ( aPatch ) ; } return text . toString ( ) ; }
Take a list of patches and return a textual representation .
51
11
20,553
private static String unescapeForEncodeUriCompatability ( String str ) { return str . replace ( "%21" , "!" ) . replace ( "%7E" , "~" ) . replace ( "%27" , "'" ) . replace ( "%28" , "(" ) . replace ( "%29" , ")" ) . replace ( "%3B" , ";" ) . replace ( "%2F" , "/" ) . replace ( "%3F" , "?" ) . replace ( "%3A" , ":" ) . replace ( "%40" , "@" ) . replace ( "%26" , "&" ) . replace ( "%3D" , "=" ) . replace ( "%2B" , "+" ) . replace ( "%24" , "$" ) . replace ( "%2C" , "," ) . replace ( "%23" , "#" ) ; }
Unescape selected chars for compatability with JavaScript s encodeURI . In speed critical applications this could be dropped since the receiving application will certainly decode these fine . Note that this function is case - sensitive . Thus %3f would not be unescaped . But this is ok because it is only called with the output of URLEncoder . encode which returns uppercase hex .
191
78
20,554
public List < java . lang . Object > getPubmedArticleOrPubmedBookArticle ( ) { if ( pubmedArticleOrPubmedBookArticle == null ) { pubmedArticleOrPubmedBookArticle = new ArrayList < java . lang . Object > ( ) ; } return this . pubmedArticleOrPubmedBookArticle ; }
Gets the value of the pubmedArticleOrPubmedBookArticle property .
71
16
20,555
public String getISSN ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_ISSN == null ) jcasType . jcas . throwFeatMissing ( "ISSN" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_ISSN ) ; }
getter for ISSN - gets The international standard serial number O
111
13
20,556
public void setISSN ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_ISSN == null ) jcasType . jcas . throwFeatMissing ( "ISSN" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_ISSN , v ) ; }
setter for ISSN - sets The international standard serial number O
114
13
20,557
public String getVolume ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_volume == null ) jcasType . jcas . throwFeatMissing ( "volume" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_volume ) ; }
getter for volume - gets The volume number of the journal in which the article was published O
107
19
20,558
public void setVolume ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_volume == null ) jcasType . jcas . throwFeatMissing ( "volume" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_volume , v ) ; }
setter for volume - sets The volume number of the journal in which the article was published O
110
19
20,559
public String getTitle ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_title == null ) jcasType . jcas . throwFeatMissing ( "title" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_title ) ; }
getter for title - gets Full journal title C
107
10
20,560
public void setTitle ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_title == null ) jcasType . jcas . throwFeatMissing ( "title" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_title , v ) ; }
setter for title - sets Full journal title C
110
10
20,561
public String getImpactFactor ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_impactFactor == null ) jcasType . jcas . throwFeatMissing ( "impactFactor" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_impactFactor ) ; }
getter for impactFactor - gets The impact factor of the journal at the time of publication O
112
19
20,562
public void setImpactFactor ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_impactFactor == null ) jcasType . jcas . throwFeatMissing ( "impactFactor" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_impactFactor , v ) ; }
setter for impactFactor - sets The impact factor of the journal at the time of publication O
115
19
20,563
public String getIssue ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_issue == null ) jcasType . jcas . throwFeatMissing ( "issue" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_issue ) ; }
getter for issue - gets Issue of Journal
107
9
20,564
public void setIssue ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_issue == null ) jcasType . jcas . throwFeatMissing ( "issue" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_issue , v ) ; }
setter for issue - sets Issue of Journal
110
9
20,565
public String getPages ( ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_pages == null ) jcasType . jcas . throwFeatMissing ( "pages" , "de.julielab.jules.types.Journal" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_pages ) ; }
getter for pages - gets Pages of Journal
107
9
20,566
public void setPages ( String v ) { if ( Journal_Type . featOkTst && ( ( Journal_Type ) jcasType ) . casFeat_pages == null ) jcasType . jcas . throwFeatMissing ( "pages" , "de.julielab.jules.types.Journal" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Journal_Type ) jcasType ) . casFeatCode_pages , v ) ; }
setter for pages - sets Pages of Journal
110
9
20,567
private static boolean isOk ( String txt ) { if ( UPPER_THEN_LOWER . matcher ( txt ) . matches ( ) ) return true ; int ints = 0 ; for ( char c : txt . toCharArray ( ) ) { if ( isDigit ( c ) ) { ints ++ ; } } if ( ints * 2 > txt . length ( ) ) return true ; return false ; }
Whitelisting . Ok if Uppercase - then - lowercases or 2x - more - digits - than - letters .
95
26
20,568
public String getOperator ( ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_operator == null ) jcasType . jcas . throwFeatMissing ( "operator" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_operator ) ; }
getter for operator - gets math operator like equal lt gt ...
117
15
20,569
public void setOperator ( String v ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_operator == null ) jcasType . jcas . throwFeatMissing ( "operator" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_operator , v ) ; }
setter for operator - sets math operator like equal lt gt ...
120
15
20,570
public float getValue ( ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_value ) ; }
getter for value - gets
116
6
20,571
public void setValue ( float v ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_value , v ) ; }
setter for value - sets
119
6
20,572
public String getVariableName ( ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_variableName == null ) jcasType . jcas . throwFeatMissing ( "variableName" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_variableName ) ; }
getter for variableName - gets
120
7
20,573
public void setVariableName ( String v ) { if ( VariableAssignment_Type . featOkTst && ( ( VariableAssignment_Type ) jcasType ) . casFeat_variableName == null ) jcasType . jcas . throwFeatMissing ( "variableName" , "ch.epfl.bbp.uima.types.VariableAssignment" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( VariableAssignment_Type ) jcasType ) . casFeatCode_variableName , v ) ; }
setter for variableName - sets
123
7
20,574
public int getElementId ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_ElementId == null ) jcasType . jcas . throwFeatMissing ( "ElementId" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_ElementId ) ; }
getter for ElementId - gets
116
7
20,575
public void setElementId ( int v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_ElementId == null ) jcasType . jcas . throwFeatMissing ( "ElementId" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_ElementId , v ) ; }
setter for ElementId - sets
119
7
20,576
public boolean getIsBold ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_isBold == null ) jcasType . jcas . throwFeatMissing ( "isBold" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_isBold ) ; }
getter for isBold - gets
121
8
20,577
public void setIsBold ( boolean v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_isBold == null ) jcasType . jcas . throwFeatMissing ( "isBold" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_isBold , v ) ; }
setter for isBold - sets
124
8
20,578
public float getHeight ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_height == null ) jcasType . jcas . throwFeatMissing ( "height" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_height ) ; }
getter for height - gets
112
6
20,579
public void setHeight ( float v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_height == null ) jcasType . jcas . throwFeatMissing ( "height" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_height , v ) ; }
setter for height - sets
115
6
20,580
public float getWidth ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_width == null ) jcasType . jcas . throwFeatMissing ( "width" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_width ) ; }
getter for width - gets
112
6
20,581
public void setWidth ( float v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_width == null ) jcasType . jcas . throwFeatMissing ( "width" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_width , v ) ; }
setter for width - sets
115
6
20,582
public float getX ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_x == null ) jcasType . jcas . throwFeatMissing ( "x" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_x ) ; }
getter for x - gets
112
6
20,583
public void setX ( float v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_x == null ) jcasType . jcas . throwFeatMissing ( "x" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_x , v ) ; }
setter for x - sets
115
6
20,584
public float getY ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_y == null ) jcasType . jcas . throwFeatMissing ( "y" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_y ) ; }
getter for y - gets
112
6
20,585
public void setY ( float v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_y == null ) jcasType . jcas . throwFeatMissing ( "y" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_y , v ) ; }
setter for y - sets
115
6
20,586
public int getPageId ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_pageId == null ) jcasType . jcas . throwFeatMissing ( "pageId" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_pageId ) ; }
getter for pageId - gets
116
7
20,587
public void setPageId ( int v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_pageId == null ) jcasType . jcas . throwFeatMissing ( "pageId" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_pageId , v ) ; }
setter for pageId - sets
119
7
20,588
public double getMedianFontsize ( ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_medianFontsize == null ) jcasType . jcas . throwFeatMissing ( "medianFontsize" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; return jcasType . ll_cas . ll_getDoubleValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_medianFontsize ) ; }
getter for medianFontsize - gets
124
8
20,589
public void setMedianFontsize ( double v ) { if ( DocumentElement_Type . featOkTst && ( ( DocumentElement_Type ) jcasType ) . casFeat_medianFontsize == null ) jcasType . jcas . throwFeatMissing ( "medianFontsize" , "ch.epfl.bbp.uima.types.DocumentElement" ) ; jcasType . ll_cas . ll_setDoubleValue ( addr , ( ( DocumentElement_Type ) jcasType ) . casFeatCode_medianFontsize , v ) ; }
setter for medianFontsize - sets
127
8
20,590
protected boolean validOutcome ( String outcome , Sequence sequence ) { if ( outcome . equals ( CONTINUE ) ) { List tags = sequence . getOutcomes ( ) ; int li = tags . size ( ) - 1 ; if ( li == - 1 ) { return false ; } else if ( ( ( String ) tags . get ( li ) ) . equals ( OTHER ) ) { return false ; } } return true ; }
This method determines wheter the outcome is valid for the preceeding sequence . This can be used to implement constraints on what sequences are valid .
88
29
20,591
public String getRegistryNumber ( ) { if ( Chemical_Type . featOkTst && ( ( Chemical_Type ) jcasType ) . casFeat_registryNumber == null ) jcasType . jcas . throwFeatMissing ( "registryNumber" , "de.julielab.jules.types.Chemical" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Chemical_Type ) jcasType ) . casFeatCode_registryNumber ) ; }
getter for registryNumber - gets A unique 5 to 9 digit number in hyphenated format assigned by the Chemical Abstract Service to specify chemical substances a zero is a valid number when an actual number cannot be located or is not yet available . C
116
49
20,592
public void setRegistryNumber ( String v ) { if ( Chemical_Type . featOkTst && ( ( Chemical_Type ) jcasType ) . casFeat_registryNumber == null ) jcasType . jcas . throwFeatMissing ( "registryNumber" , "de.julielab.jules.types.Chemical" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Chemical_Type ) jcasType ) . casFeatCode_registryNumber , v ) ; }
setter for registryNumber - sets A unique 5 to 9 digit number in hyphenated format assigned by the Chemical Abstract Service to specify chemical substances a zero is a valid number when an actual number cannot be located or is not yet available . C
119
49
20,593
public String getNameOfSubstance ( ) { if ( Chemical_Type . featOkTst && ( ( Chemical_Type ) jcasType ) . casFeat_nameOfSubstance == null ) jcasType . jcas . throwFeatMissing ( "nameOfSubstance" , "de.julielab.jules.types.Chemical" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Chemical_Type ) jcasType ) . casFeatCode_nameOfSubstance ) ; }
getter for nameOfSubstance - gets The name of the substance that the registry number or the E . C . number identifies C
124
28
20,594
public void setNameOfSubstance ( String v ) { if ( Chemical_Type . featOkTst && ( ( Chemical_Type ) jcasType ) . casFeat_nameOfSubstance == null ) jcasType . jcas . throwFeatMissing ( "nameOfSubstance" , "de.julielab.jules.types.Chemical" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Chemical_Type ) jcasType ) . casFeatCode_nameOfSubstance , v ) ; }
setter for nameOfSubstance - sets The name of the substance that the registry number or the E . C . number identifies C
127
28
20,595
public static List < String > splitSentence2 ( String text , SentenceDetector sd ) { List < String > sentences = new ArrayList < String > ( ) ; try { int sentenceOffsets [ ] = sd . sentPosDetect ( text ) ; int begin = 0 ; int end = 0 ; for ( int i = 0 ; i < sentenceOffsets . length ; i ++ ) { end = begin + ( text . substring ( begin , sentenceOffsets [ i ] ) . trim ( ) ) . length ( ) ; sentences . add ( text . substring ( begin , end ) ) ; begin = sentenceOffsets [ i ] ; } } catch ( Exception e ) { LOG . warn ( "failed to extract sentences from text '" + text + "'" , e ) ; } return sentences ; }
Conv . method to use the SentenceDetector directly ; create it with the method below
171
19
20,596
public String getPolarity ( ) { if ( EventMention_Type . featOkTst && ( ( EventMention_Type ) jcasType ) . casFeat_polarity == null ) jcasType . jcas . throwFeatMissing ( "polarity" , "de.julielab.jules.types.EventMention" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( EventMention_Type ) jcasType ) . casFeatCode_polarity ) ; }
getter for polarity - gets
123
7
20,597
public EventTrigger getTrigger ( ) { if ( EventMention_Type . featOkTst && ( ( EventMention_Type ) jcasType ) . casFeat_trigger == null ) jcasType . jcas . throwFeatMissing ( "trigger" , "de.julielab.jules.types.EventMention" ) ; return ( EventTrigger ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EventMention_Type ) jcasType ) . casFeatCode_trigger ) ) ) ; }
getter for trigger - gets
138
6
20,598
public void setTrigger ( EventTrigger v ) { if ( EventMention_Type . featOkTst && ( ( EventMention_Type ) jcasType ) . casFeat_trigger == null ) jcasType . jcas . throwFeatMissing ( "trigger" , "de.julielab.jules.types.EventMention" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( EventMention_Type ) jcasType ) . casFeatCode_trigger , jcasType . ll_cas . ll_getFSRef ( v ) ) ; }
setter for trigger - sets
134
6
20,599
public String getRefid ( ) { if ( EventArgument_Type . featOkTst && ( ( EventArgument_Type ) jcasType ) . casFeat_refid == null ) jcasType . jcas . throwFeatMissing ( "refid" , "de.julielab.jules.types.ace.EventArgument" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( EventArgument_Type ) jcasType ) . casFeatCode_refid ) ; }
getter for refid - gets
121
7