idx int64 0 165k | question stringlengths 73 5.81k | target stringlengths 5 918 |
|---|---|---|
20,500 | public FSArray getDocuments ( ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_documents == null ) jcasType . jcas . throwFeatMissing ( "documents" , "de.julielab.jules.types.ace.SourceFile" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents ) ) ) ; } | getter for documents - gets |
20,501 | public void setDocuments ( FSArray v ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_documents == null ) jcasType . jcas . throwFeatMissing ( "documents" , "de.julielab.jules.types.ace.SourceFile" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for documents - sets |
20,502 | public Document getDocuments ( int i ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_documents == null ) jcasType . jcas . throwFeatMissing ( "documents" , "de.julielab.jules.types.ace.SourceFile" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents ) , i ) ; return ( Document ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents ) , i ) ) ) ; } | indexed getter for documents - gets an indexed value - |
20,503 | public void setDocuments ( int i , Document v ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_documents == null ) jcasType . jcas . throwFeatMissing ( "documents" , "de.julielab.jules.types.ace.SourceFile" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_documents ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for documents - sets an indexed value - |
20,504 | public String getAce_type ( ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_ace_type == null ) jcasType . jcas . throwFeatMissing ( "ace_type" , "de.julielab.jules.types.ace.SourceFile" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_ace_type ) ; } | getter for ace_type - gets |
20,505 | public void setAce_type ( String v ) { if ( SourceFile_Type . featOkTst && ( ( SourceFile_Type ) jcasType ) . casFeat_ace_type == null ) jcasType . jcas . throwFeatMissing ( "ace_type" , "de.julielab.jules.types.ace.SourceFile" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( SourceFile_Type ) jcasType ) . casFeatCode_ace_type , v ) ; } | setter for ace_type - sets |
20,506 | public void addAll ( ExampleSet data ) { for ( int i = 0 ; i < data . size ( ) ; i ++ ) add ( data . x ( i ) , data . y ( i ) , data . id ( i ) ) ; } | Appends all of the elements in the specified example set to the end of this example set . |
20,507 | public String getAnnotationLevel ( ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_annotationLevel == null ) jcasType . jcas . throwFeatMissing ( "annotationLevel" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_annotationLevel ) ; } | getter for annotationLevel - gets The MMAX annotation level . |
20,508 | public void setAnnotationLevel ( String v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_annotationLevel == null ) jcasType . jcas . throwFeatMissing ( "annotationLevel" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_annotationLevel , v ) ; } | setter for annotationLevel - sets The MMAX annotation level . |
20,509 | public FSArray getSegmentList ( ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_segmentList == null ) jcasType . jcas . throwFeatMissing ( "segmentList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList ) ) ) ; } | getter for segmentList - gets List of MMAX annotation segements that make up the MMAX annotation . |
20,510 | public void setSegmentList ( FSArray v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_segmentList == null ) jcasType . jcas . throwFeatMissing ( "segmentList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for segmentList - sets List of MMAX annotation segements that make up the MMAX annotation . |
20,511 | public AnnotationSegment getSegmentList ( int i ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_segmentList == null ) jcasType . jcas . throwFeatMissing ( "segmentList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList ) , i ) ; return ( AnnotationSegment ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList ) , i ) ) ) ; } | indexed getter for segmentList - gets an indexed value - List of MMAX annotation segements that make up the MMAX annotation . |
20,512 | public void setSegmentList ( int i , AnnotationSegment v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_segmentList == null ) jcasType . jcas . throwFeatMissing ( "segmentList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_segmentList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for segmentList - sets an indexed value - List of MMAX annotation segements that make up the MMAX annotation . |
20,513 | public FSArray getAttributeList ( ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_attributeList == null ) jcasType . jcas . throwFeatMissing ( "attributeList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList ) ) ) ; } | getter for attributeList - gets List of attributes of the MMAX annotation . |
20,514 | public void setAttributeList ( FSArray v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_attributeList == null ) jcasType . jcas . throwFeatMissing ( "attributeList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for attributeList - sets List of attributes of the MMAX annotation . |
20,515 | public MMAXAttribute getAttributeList ( int i ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_attributeList == null ) jcasType . jcas . throwFeatMissing ( "attributeList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList ) , i ) ; return ( MMAXAttribute ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList ) , i ) ) ) ; } | indexed getter for attributeList - gets an indexed value - List of attributes of the MMAX annotation . |
20,516 | public void setAttributeList ( int i , MMAXAttribute v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_attributeList == null ) jcasType . jcas . throwFeatMissing ( "attributeList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_attributeList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for attributeList - sets an indexed value - List of attributes of the MMAX annotation . |
20,517 | public FSArray getPointerList ( ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_pointerList == null ) jcasType . jcas . throwFeatMissing ( "pointerList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList ) ) ) ; } | getter for pointerList - gets The list of MMAX pointers of the MMAX annotation . |
20,518 | public void setPointerList ( FSArray v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_pointerList == null ) jcasType . jcas . throwFeatMissing ( "pointerList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for pointerList - sets The list of MMAX pointers of the MMAX annotation . |
20,519 | public MMAXPointer getPointerList ( int i ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_pointerList == null ) jcasType . jcas . throwFeatMissing ( "pointerList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList ) , i ) ; return ( MMAXPointer ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList ) , i ) ) ) ; } | indexed getter for pointerList - gets an indexed value - The list of MMAX pointers of the MMAX annotation . |
20,520 | public void setPointerList ( int i , MMAXPointer v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_pointerList == null ) jcasType . jcas . throwFeatMissing ( "pointerList" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_pointerList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for pointerList - sets an indexed value - The list of MMAX pointers of the MMAX annotation . |
20,521 | public String getAdaptedCoveredText ( ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_adaptedCoveredText == null ) jcasType . jcas . throwFeatMissing ( "adaptedCoveredText" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_adaptedCoveredText ) ; } | getter for adaptedCoveredText - gets Text covered by the annotation . This feature is helpful if the annotations is discontinuous ... |
20,522 | public void setAdaptedCoveredText ( String v ) { if ( MMAXAnnotation_Type . featOkTst && ( ( MMAXAnnotation_Type ) jcasType ) . casFeat_adaptedCoveredText == null ) jcasType . jcas . throwFeatMissing ( "adaptedCoveredText" , "de.julielab.jules.types.mmax.MMAXAnnotation" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( MMAXAnnotation_Type ) jcasType ) . casFeatCode_adaptedCoveredText , v ) ; } | setter for adaptedCoveredText - sets Text covered by the annotation . This feature is helpful if the annotations is discontinuous ... |
20,523 | public void initializationComplete ( ) { if ( UIMAFramework . getLogger ( ) . isLoggable ( Level . CONFIG ) ) { UIMAFramework . getLogger ( this . getClass ( ) ) . logrb ( Level . CONFIG , this . getClass ( ) . getName ( ) , "process" , CPMUtils . CPM_LOG_RESOURCE_BUNDLE , "UIMA_CPM_cpm_init_complete__CONFIG" , new Object [ ] { Thread . currentThread ( ) . getName ( ) } ) ; } } | Called when the initialization is completed . |
20,524 | public synchronized void batchProcessComplete ( ) { if ( UIMAFramework . getLogger ( ) . isLoggable ( Level . FINEST ) ) { UIMAFramework . getLogger ( this . getClass ( ) ) . logrb ( Level . FINEST , this . getClass ( ) . getName ( ) , "process" , CPMUtils . CPM_LOG_RESOURCE_BUNDLE , "UIMA_CPM_method_ping__FINEST" , new Object [ ] { Thread . currentThread ( ) . getName ( ) } ) ; } } | Called when the batchProcessing is completed . |
20,525 | private TreeObject createDummyModel ( ) { TreeObject to1 = new TreeObject ( "Inbox" ) ; TreeObject to2 = new TreeObject ( "Drafts" ) ; TreeObject to3 = new TreeObject ( "Sent" ) ; TreeParent p1 = new TreeParent ( "me@this.com" ) ; p1 . addChild ( to1 ) ; p1 . addChild ( to2 ) ; p1 . addChild ( to3 ) ; TreeObject to4 = new TreeObject ( "Inbox" ) ; TreeParent p2 = new TreeParent ( "other@aol.com" ) ; p2 . addChild ( to4 ) ; TreeParent root = new TreeParent ( "" ) ; root . addChild ( p1 ) ; root . addChild ( p2 ) ; return root ; } | We will set up a dummy model to initialize tree heararchy . In real code you will connect to a real model and expose its hierarchy . |
20,526 | public static void runPipeline ( File scriptFile , List < String > cliArgs ) throws IOException , UIMAException , ParseException { if ( ! scriptFile . exists ( ) ) { throw new IOException ( "Script file does not exist (" + scriptFile . getAbsolutePath ( ) + ")" ) ; } LOG . info ( "Parsing pipeline script at '{}'" , scriptFile . getAbsolutePath ( ) + " \n with CLI parameters: " + join ( cliArgs , ", " ) ) ; Pipeline pipeline = null ; try { pipeline = PipelineScriptParser . parse ( scriptFile , cliArgs ) ; } catch ( ParseException e ) { throw new ParseException ( "\nERROR parsing '" + scriptFile . getName ( ) + "'\n" + e . getMessage ( ) + "\n(see the README.txt for the pipeline script format)" , e . getErrorOffset ( ) ) ; } LOG . info ( "Successfully parsed pipeline script, now starting pipeline..." ) ; LOG . info ( "*************************************************************" ) ; pipeline . run ( ) ; System . out . println ( OK_MESSAGE ) ; } | Parse this pipeline and run it |
20,527 | public MaxentModel getModel ( ModelDomain domain ) { if ( map . containsKey ( domain ) ) { return ( MaxentModel ) map . get ( domain ) ; } else { throw new NoSuchElementException ( "No model has been created for " + "domain: " + domain ) ; } } | Get the model mapped to by the given ModelDomain key . |
20,528 | public String getBuilding ( ) { if ( RoomNumber_Type . featOkTst && ( ( RoomNumber_Type ) jcasType ) . casFeat_building == null ) jcasType . jcas . throwFeatMissing ( "building" , "org.apache.uima.examples.RoomNumber" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( RoomNumber_Type ) jcasType ) . casFeatCode_building ) ; } | getter for building - gets |
20,529 | public void setBuilding ( String v ) { if ( RoomNumber_Type . featOkTst && ( ( RoomNumber_Type ) jcasType ) . casFeat_building == null ) jcasType . jcas . throwFeatMissing ( "building" , "org.apache.uima.examples.RoomNumber" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( RoomNumber_Type ) jcasType ) . casFeatCode_building , v ) ; } | setter for building - sets |
20,530 | @ Deprecated ( ) public static AnalysisEngineDescription getBrainregionRules ( ) throws ResourceInitializationException { return createEngineDescription ( RutaEngine . class , PARAM_MAIN_SCRIPT , "Main" , PARAM_SCRIPT_PATHS , BRAIN_REGIONS_HOME + RESOURCES_PATH + "ruta" , PARAM_RESOURCE_PATHS , LEXICON_HOME ) ; } | Many pre - and postprocessing needed see the tests |
20,531 | public static String cleanBlockText ( String text ) { if ( text == null || text . length ( ) < 6 ) return null ; if ( text . length ( ) < 6 ) { return null ; } int firstReturn = text . indexOf ( "\n" ) ; if ( firstReturn > - 1 ) { text = text . substring ( 0 , firstReturn ) ; } text = text . replaceAll ( " +" , " " ) . trim ( ) ; text = text . replaceAll ( "^\\d*" , "" ) . replaceAll ( "\t" , " " ) . trim ( ) ; if ( text . length ( ) > 0 && text . charAt ( 0 ) == '.' ) { text = text . substring ( 1 ) . trim ( ) ; } double letters = 0 ; for ( int i = 0 ; i < text . length ( ) ; i ++ ) { if ( Character . isLetter ( text . charAt ( i ) ) ) letters ++ ; } if ( ( letters / ( text . length ( ) + 0d ) ) < 0.5d ) { return null ; } String stemmed = "" ; for ( String token : text . trim ( ) . split ( " " ) ) { stemmed += stemmer . stem ( token ) + " " ; } String snippet = StringUtils . snippetize ( stemmed . trim ( ) , 30 ) ; return snippet . trim ( ) ; } | Used to identify block titles like Introduction References |
20,532 | public java . util . List < Sec > getSec ( ) { if ( sec == null ) { sec = new ArrayList < Sec > ( ) ; } return this . sec ; } | Gets the value of the sec property . |
20,533 | public java . util . List < Object > getNotesOrFnGroupOrGlossary ( ) { if ( notesOrFnGroupOrGlossary == null ) { notesOrFnGroupOrGlossary = new ArrayList < Object > ( ) ; } return this . notesOrFnGroupOrGlossary ; } | Gets the value of the notesOrFnGroupOrGlossary property . |
20,534 | public void addInstance ( String src , String id , String text ) { Instance inst = new Instance ( src , id , text ) ; ArrayList list = ( ArrayList ) sourceLists . get ( src ) ; if ( list == null ) { list = new ArrayList ( ) ; sourceLists . put ( src , list ) ; sourceNames . add ( src ) ; } list . add ( inst ) ; } | Add a single instance with given src and id to the datafile |
20,535 | public Instance getInstance ( String src , int j ) { return ( Instance ) ( ( ArrayList ) sourceLists . get ( src ) ) . get ( j ) ; } | Get the j - th record for the named source . |
20,536 | 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 . |
20,537 | 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 ( ) ; 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 . |
20,538 | 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 ( ) ; 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 . |
20,539 | 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 . |
20,540 | 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 . |
20,541 | 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 . |
20,542 | 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 . |
20,543 | 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 . |
20,544 | 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 . |
20,545 | 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 |
20,546 | 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 . |
20,547 | 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 . |
20,548 | 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 . |
20,549 | public static String extractText ( Article article ) { StringBuilder sb = new StringBuilder ( ) ; List < Abstract > abstracts = article . getFront ( ) . getArticleMeta ( ) . getAbstract ( ) ; for ( Abstract abstrct : abstracts ) { for ( Sec sec : abstrct . getSec ( ) ) { processTextContent ( sec . getAddressOrAlternativesOrArray ( ) , sb , true ) ; } } sb . append ( '\n' ) ; 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 ( '\n' ) ; } processTextContent ( sec . getAddressOrAlternativesOrArray ( ) , sb , false ) ; } } return removeNoise ( sb . toString ( ) ) ; } | Iterates recursively over all objects of this article and tries to extract its text |
20,550 | private static String removeNoise ( String s ) { return s . replace ( " " , " " ) . replace ( " " , " " ) . replace ( " , " , " " ) . replace ( " ( )" , "" ) . replace ( " " , " " ) . replace ( " ", ") / . replace ( "[ – ]", " "). r e place(" [ ]", " ); / / } | removing noise could be improved ... |
20,551 | public java . util . List < Object > getContent ( ) { if ( content == null ) { content = new ArrayList < Object > ( ) ; } return this . content ; } | Gets the value of the content property . |
20,552 | 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 |
20,553 | 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 |
20,554 | 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 . |
20,555 | 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 |
20,556 | 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 |
20,557 | 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 |
20,558 | 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 |
20,559 | 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 |
20,560 | 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 |
20,561 | 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 |
20,562 | 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 |
20,563 | public Sentence filter ( Sentence 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 ; } } 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 |
20,564 | 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 |
20,565 | 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 |
20,566 | 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 |
20,567 | 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 |
20,568 | 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 . |
20,569 | 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 . |
20,570 | 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 |
20,571 | 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 |
20,572 | 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 . |
20,573 | 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 . |
20,574 | public LinkedList < Diff > diff_main ( String text1 , String text2 , boolean checklines ) { 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 . |
20,575 | private LinkedList < Diff > diff_main ( String text1 , String text2 , boolean checklines , long deadline ) { if ( text1 == null || text2 == null ) { throw new IllegalArgumentException ( "Null inputs. (diff_main)" ) ; } LinkedList < Diff > diffs ; if ( text1 . equals ( text2 ) ) { diffs = new LinkedList < Diff > ( ) ; if ( text1 . length ( ) != 0 ) { diffs . add ( new Diff ( Operation . EQUAL , text1 ) ) ; } return diffs ; } int commonlength = diff_commonPrefix ( text1 , text2 ) ; String commonprefix = text1 . substring ( 0 , commonlength ) ; text1 = text1 . substring ( commonlength ) ; text2 = text2 . substring ( commonlength ) ; 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 ) ; diffs = diff_compute ( text1 , text2 , checklines , deadline ) ; 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 . |
20,576 | public String diff_prettyHtml ( LinkedList < Diff > diffs ) { StringBuilder html = new StringBuilder ( ) ; for ( Diff aDiff : diffs ) { String text = aDiff . text . replace ( "&" , "&" ) . replace ( "<" , "<" ) . replace ( ">" , ">" ) . replace ( "\n" , "¶<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 . |
20,577 | 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 ) { 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 ) { 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 . |
20,578 | public static int match_main ( String text , String pattern , int loc ) { 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 ) ) { return 0 ; } else if ( text . length ( ) == 0 ) { return - 1 ; } else if ( loc + pattern . length ( ) <= text . length ( ) && text . substring ( loc , loc + pattern . length ( ) ) . equals ( pattern ) ) { return loc ; } else { return match_bitap ( text , pattern , loc ) ; } } | Locate the best instance of pattern in text near loc . Returns - 1 if no match found . |
20,579 | @ 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 ) { 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 . |
20,580 | 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 . |
20,581 | 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 ; 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 ) ) ; } padding += Patch_Margin ; String prefix = text . substring ( Math . max ( 0 , patch . start2 - padding ) , patch . start2 ) ; if ( prefix . length ( ) != 0 ) { patch . diffs . addFirst ( new Diff ( Operation . EQUAL , prefix ) ) ; } 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 ) ) ; } patch . start1 -= prefix . length ( ) ; patch . start2 -= prefix . length ( ) ; 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 . |
20,582 | public LinkedList < Patch > patch_make ( String text1 , String text2 ) { if ( text1 == null || text2 == null ) { throw new IllegalArgumentException ( "Null inputs. (patch_make)" ) ; } 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 . |
20,583 | public LinkedList < Patch > patch_make ( LinkedList < Diff > diffs ) { if ( diffs == null ) { throw new IllegalArgumentException ( "Null inputs. (patch_make)" ) ; } 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 . |
20,584 | 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 . |
20,585 | 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 . |
20,586 | 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 ) ; } for ( Patch aPatch : patches ) { aPatch . start1 += paddingLength ; aPatch . start2 += paddingLength ; } Patch patch = patches . getFirst ( ) ; LinkedList < Diff > diffs = patch . diffs ; if ( diffs . isEmpty ( ) || diffs . getFirst ( ) . operation != Operation . EQUAL ) { diffs . addFirst ( new Diff ( Operation . EQUAL , nullPadding ) ) ; patch . start1 -= paddingLength ; patch . start2 -= paddingLength ; patch . length1 += paddingLength ; patch . length2 += paddingLength ; } else if ( paddingLength > diffs . getFirst ( ) . text . length ( ) ) { 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 ; } patch = patches . getLast ( ) ; diffs = patch . diffs ; if ( diffs . isEmpty ( ) || diffs . getLast ( ) . operation != Operation . EQUAL ) { diffs . addLast ( new Diff ( Operation . EQUAL , nullPadding ) ) ; patch . length1 += paddingLength ; patch . length2 += paddingLength ; } else if ( paddingLength > diffs . getLast ( ) . text . length ( ) ) { 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 . |
20,587 | 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 . |
20,588 | 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 . |
20,589 | 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 . |
20,590 | 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 |
20,591 | 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 |
20,592 | 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 |
20,593 | 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 |
20,594 | 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 |
20,595 | 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 |
20,596 | 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 |
20,597 | 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 |
20,598 | 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 |
20,599 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.