idx int64 0 165k | question stringlengths 73 4.15k | target stringlengths 5 918 | len_question int64 21 890 | len_target int64 3 255 |
|---|---|---|---|---|
20,700 | final protected static void doMain ( StringDistance d , String [ ] argv ) { if ( argv . length != 2 ) { System . out . println ( "usage: string1 string2" ) ; } else { System . out . println ( d . explainScore ( argv [ 0 ] , argv [ 1 ] ) ) ; } } | Default main routine for testing | 74 | 5 |
20,701 | public int getAlignedChar ( int iMinusOne , boolean preferHigherIndices ) { // internally to this package, strings are indexed 1...N, so // we need to convert from the usual 0...N-1 Java convention int i = iMinusOne + 1 ; int bestJ = - 1 ; double bestScore = - Double . MAX_VALUE ; for ( int j = mat . getFirstStoredEntryInRow ( i ) ; j <= mat . getLastStoredEntryInRow ( i ) ; j ++ ) { if ( mat . outOfRange ( i , j ) ) log . error ( "out of range: " + i + "," + j ) ; double score = mat . get ( i , j ) ; if ( ( score > bestScore ) || ( score == bestScore && preferHigherIndices ) ) { bestScore = score ; bestJ = j ; } } // convert back to the usual 0...N-1 Java convention return bestJ - 1 ; } | Find a character in the first string s that can be aligned with the i - th character in the second string t . | 212 | 24 |
20,702 | public String getCopyright ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_copyright == null ) jcasType . jcas . throwFeatMissing ( "copyright" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_copyright ) ; } | getter for copyright - gets Copyright information C | 110 | 9 |
20,703 | public void setCopyright ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_copyright == null ) jcasType . jcas . throwFeatMissing ( "copyright" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_copyright , v ) ; } | setter for copyright - sets Copyright information C | 113 | 9 |
20,704 | public boolean getTruncated ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_truncated == null ) jcasType . jcas . throwFeatMissing ( "truncated" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_truncated ) ; } | getter for truncated - gets Indicates whether the document is truncated C | 116 | 16 |
20,705 | public void setTruncated ( boolean v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_truncated == null ) jcasType . jcas . throwFeatMissing ( "truncated" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_truncated , v ) ; } | setter for truncated - sets Indicates whether the document is truncated C | 119 | 16 |
20,706 | public FSArray getAuthors ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) ) ) ; } | getter for authors - gets The authors of the document O | 131 | 12 |
20,707 | public void setAuthors ( FSArray v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for authors - sets The authors of the document O | 127 | 12 |
20,708 | public AuthorInfo getAuthors ( int i ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ; return ( AuthorInfo ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ) ) ; } | indexed getter for authors - gets an indexed value - The authors of the document O | 201 | 18 |
20,709 | public void setAuthors ( int i , AuthorInfo v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_authors == null ) jcasType . jcas . throwFeatMissing ( "authors" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_authors ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for authors - sets an indexed value - The authors of the document O | 198 | 18 |
20,710 | public FSArray getPubTypeList ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) ) ) ; } | getter for pubTypeList - gets The list of the publication types O | 138 | 15 |
20,711 | public void setPubTypeList ( FSArray v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for pubTypeList - sets The list of the publication types O | 134 | 15 |
20,712 | public PubType getPubTypeList ( int i ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ; return ( PubType ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ) ) ; } | indexed getter for pubTypeList - gets an indexed value - The list of the publication types O | 210 | 21 |
20,713 | public void setPubTypeList ( int i , PubType v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_pubTypeList == null ) jcasType . jcas . throwFeatMissing ( "pubTypeList" , "de.julielab.jules.types.Header" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_pubTypeList ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for pubTypeList - sets an indexed value - The list of the publication types O | 207 | 21 |
20,714 | public String getLanguage ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_language == null ) jcasType . jcas . throwFeatMissing ( "language" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_language ) ; } | getter for language - gets The language of the document O | 107 | 12 |
20,715 | public void setLanguage ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_language == null ) jcasType . jcas . throwFeatMissing ( "language" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_language , v ) ; } | setter for language - sets The language of the document O | 110 | 12 |
20,716 | public String getDoi ( ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_doi == null ) jcasType . jcas . throwFeatMissing ( "doi" , "de.julielab.jules.types.Header" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_doi ) ; } | getter for doi - gets document object identifier | 108 | 9 |
20,717 | public void setDoi ( String v ) { if ( Header_Type . featOkTst && ( ( Header_Type ) jcasType ) . casFeat_doi == null ) jcasType . jcas . throwFeatMissing ( "doi" , "de.julielab.jules.types.Header" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Header_Type ) jcasType ) . casFeatCode_doi , v ) ; } | setter for doi - sets document object identifier | 111 | 9 |
20,718 | public int getDocumentFrequency ( Token token ) { Integer df = ( Integer ) documentFrequency . get ( token ) ; if ( df == null ) return 0 ; else return df . intValue ( ) ; } | Get the document frequency of the token . | 45 | 8 |
20,719 | public void setGender ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_gender == null ) jcasType . jcas . throwFeatMissing ( "gender" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_gender , v ) ; } | setter for gender - sets Gender | 126 | 7 |
20,720 | public String getCase ( ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_case == null ) jcasType . jcas . throwFeatMissing ( "case" , "de.julielab.jules.types.PronounFeats" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_case ) ; } | getter for case - gets Case | 123 | 7 |
20,721 | public void setCase ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_case == null ) jcasType . jcas . throwFeatMissing ( "case" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_case , v ) ; } | setter for case - sets Case | 126 | 7 |
20,722 | public String getNumber ( ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_number == null ) jcasType . jcas . throwFeatMissing ( "number" , "de.julielab.jules.types.PronounFeats" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_number ) ; } | getter for number - gets Number | 123 | 7 |
20,723 | public void setNumber ( String v ) { if ( PronounFeats_Type . featOkTst && ( ( PronounFeats_Type ) jcasType ) . casFeat_number == null ) jcasType . jcas . throwFeatMissing ( "number" , "de.julielab.jules.types.PronounFeats" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( PronounFeats_Type ) jcasType ) . casFeatCode_number , v ) ; } | setter for number - sets Number | 126 | 7 |
20,724 | public java . util . List < Object > getHeaders ( ) { if ( headers == null ) { headers = new ArrayList < Object > ( ) ; } return this . headers ; } | Gets the value of the headers property . | 40 | 9 |
20,725 | public String getComponentId ( ) { if ( Annotation_Type . featOkTst && ( ( Annotation_Type ) jcasType ) . casFeat_componentId == null ) jcasType . jcas . throwFeatMissing ( "componentId" , "de.julielab.jules.types.Annotation" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Annotation_Type ) jcasType ) . casFeatCode_componentId ) ; } | getter for componentId - gets Indicates which NLP component has been used to derive the annotation C | 115 | 21 |
20,726 | public void setComponentId ( String v ) { if ( Annotation_Type . featOkTst && ( ( Annotation_Type ) jcasType ) . casFeat_componentId == null ) jcasType . jcas . throwFeatMissing ( "componentId" , "de.julielab.jules.types.Annotation" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Annotation_Type ) jcasType ) . casFeatCode_componentId , v ) ; } | setter for componentId - sets Indicates which NLP component has been used to derive the annotation C | 118 | 21 |
20,727 | public void add ( String text , MentionType type ) { MentionType previousType = entities . add ( process ( text ) , type ) ; if ( previousType != null && ! previousType . equals ( type ) ) throw new IllegalArgumentException ( "Text is already associated with a different tag: " + text ) ; } | Adds a single entry to the dictionary . The text is processed by the tokenizer and the resulting tokens are stored . | 70 | 23 |
20,728 | public void toFrequencyFile ( String filePath ) throws IOException { BufferedWriter writer = new BufferedWriter ( new OutputStreamWriter ( new FileOutputStream ( filePath ) , "UTF-8" ) ) ; for ( TrieNodeCnt child : root . children . values ( ) ) { child . writeFrequencies ( writer , new char [ 0 ] ) ; // recursive } writer . close ( ) ; } | one entry per line . word first then tab then frequency | 91 | 11 |
20,729 | public FSArray getNames ( ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) ) ) ; } | getter for names - gets | 136 | 6 |
20,730 | public void setNames ( FSArray v ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for names - sets | 132 | 6 |
20,731 | public Name getNames ( int i ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ; return ( Name ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ) ) ; } | indexed getter for names - gets an indexed value - | 205 | 12 |
20,732 | public void setNames ( int i , Name v ) { if ( EntityAttribute_Type . featOkTst && ( ( EntityAttribute_Type ) jcasType ) . casFeat_names == null ) jcasType . jcas . throwFeatMissing ( "names" , "de.julielab.jules.types.ace.EntityAttribute" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( EntityAttribute_Type ) jcasType ) . casFeatCode_names ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for names - sets an indexed value - | 203 | 12 |
20,733 | private boolean judgeHTMLCode ( ArrayList < ArrayList < TextPiece > > wordsByPage ) { ArrayList < TextPiece > wordsOfPageOne = wordsByPage . get ( 0 ) ; boolean isHTMLCode = true ; int i = 0 ; /* * do not have to check all words, Checking 10 words is enough */ while ( i < Math . min ( 20 , wordsOfPageOne . size ( ) ) ) { TextPiece currentWord = wordsOfPageOne . get ( i ) ; String thisText = currentWord . getText ( ) ; if ( ( thisText . length ( ) % 2 != 0 ) && ( thisText . matches ( "([A-Z]([A-Z]|[0-9]))*" ) == false ) ) { isHTMLCode = false ; break ; } i ++ ; } // if (isHTMLCode) // System.out.println("This document is coded in HTML code!"); return isHTMLCode ; } | Detects documents encoded in HTML code | 219 | 7 |
20,734 | private void extractFiguresFromAPage ( ArrayList < TextPiece > linesOfAPage , ArrayList < TextPiece > wordsOfAPage , int i , File pdfFile , ArrayList < ArrayList < TextPiece > > linesByPage ) { if ( linesOfAPage . size ( ) > 30 ) { // if this page is very short, it // usually does not contain tables /* * Checks for table keyword */ boolean figureKwdExist = false ; int prevTableEndIndex = 0 ; int k = - 1 ; for ( TextPiece t : linesOfAPage ) { k ++ ; String textWithoutSpace = t . getText ( ) . replace ( " " , "" ) ; TextPiece prevLine = ( k == 0 ) ? null : linesOfAPage . get ( k - 1 ) ; if ( getMatchedFigureKeyword ( textWithoutSpace ) != null ) { figureKwdExist = true ; String figKwd = getMatchedFigureKeyword ( textWithoutSpace ) ; System . out . println ( "In page " + ( i + 1 ) + ": " + textWithoutSpace ) ; } } } else { /* * Impossible to contain tables because of few texts in the page */ } } | Extracts figures from ONE page | 266 | 7 |
20,735 | private int extractOneTable ( int lineNumber , ArrayList < TextPiece > linesOfAPage , String keyword , TableCandidate tc , ArrayList < TextPiece > wordsOfAPage , int i , int prevTableEndIndex , ArrayList < ArrayList < TextPiece > > linesByPage ) { TextPiece line = linesOfAPage . get ( lineNumber ) ; if ( line . getX ( ) < 0 && line . getWidth ( ) == 0.0 ) { System . out . println ( "\n This is a reversed table, currently we do not support such tables!" ) ; lineNumber ++ ; tc . setValid ( false ) ; } else { lineNumber = findCaptionBoundary ( lineNumber , linesOfAPage , tc ) ; if ( tc . isValid ( ) ) { tc . setPageId_thisTable ( i ) ; // getReferenceTableTexts(tc, linesByPage); isWideTable ( tc ) ; Vector distinctY = new Vector ( ) ; Vector piecesEachY = new Vector ( ) ; distinctY = getDistinctSortedY ( distinctY , piecesEachY , wordsOfAPage , tc ) ; boolean aboveCaption = judgeCaptionLocation ( linesOfAPage , tc , distinctY , wordsOfAPage ) ; lineNumber = findBodyBoundary ( lineNumber , linesOfAPage , tc , aboveCaption , prevTableEndIndex ) ; getReferenceTableTexts ( tc , linesByPage ) ; // System.out.println(tc.getRefText()); } tc . setHighLevelMeta ( i ) ; if ( tc . isValid ( ) ) { organizeCells ( linesOfAPage , tc ) ; } if ( tc . isValid ( ) ) { findFootnoteBeginRow ( tc ) ; } if ( tc . isValid ( ) ) { determineFootnoteHeading ( tc ) ; getColumnBoundaryWithoutHeading ( tc ) ; } int cc = tc . getColumnNum_thisTable ( ) ; if ( cc > 20 ) { tc . setValid ( false ) ; } else { // if((cc>=2) && (tc.getMaxColumnNumber()<cc*2) ) { //if we // treat each line as the possible table beginning without // considering the table keyword, we need use this if ( cc >= 2 ) { getTableStructure ( cc , tc , wordsOfAPage ) ; // if (tc.isValid()) parameters.tableNum++; } else { tc . setEmptyMetadataStructureLevel ( tc . getRows ( ) . size ( ) , cc , wordsOfAPage , m_docInfo ) ; } } } return lineNumber ; } | Extracts a table if detecting a potential table caption | 574 | 11 |
20,736 | private void isWideTable ( TableCandidate tc ) { float docWidth = m_docInfo . getMaxX ( ) - m_docInfo . getMinX ( ) ; if ( ( ( ( tc . getCaptionX ( ) > ( ( docWidth - 30 ) / ( float ) 4.0 ) + m_docInfo . getMinX ( ) ) ) && ( tc . getCaptionX ( ) < docWidth / 2.5 ) ) || ( tc . getCaptonEndX ( ) - tc . getCaptionX ( ) > docWidth / ( float ) 1.85 ) ) { tc . setWideTable ( true ) ; // System.out.println(); // System.out.println("This is a wide table? " + tc.isWideTable()); } else { // System.out.println(); // System.out.println("This is a single-doc-column table!"); } } | Judges whether a table is a wide table or not by considering the width of the table | 199 | 18 |
20,737 | private void organizeCells ( ArrayList < TextPiece > linesOfAPage , TableCandidate tc ) { float captionY = linesOfAPage . get ( tc . getCaptionStartLine ( ) ) . getY ( ) ; float captionEndY = linesOfAPage . get ( tc . getCaptionEndLine ( ) ) . getEndY ( ) ; ArrayList < TextPiece > rawCells = new ArrayList < TextPiece > ( ) ; /* * Copy & sort */ for ( int i = tc . getBodyStartLine ( ) ; i <= tc . getBodyEndLine ( ) ; i ++ ) { rawCells . add ( linesOfAPage . get ( i ) ) ; } Collections . sort ( rawCells ) ; assert rawCells . size ( ) >= 4 ; // due to previous check TableRow currentRow = null ; // creates first row for ( TextPiece cell : rawCells ) { /* * Skips lines beyond caption //TODO: remove the far Y */ if ( tc . isTopCaption ( ) && ( cell . getY ( ) < captionY ) ) continue ; if ( ! tc . isTopCaption ( ) && ( cell . getEndY ( ) > captionEndY ) ) continue ; /* * Lines too close to each other are treated as a single line */ if ( currentRow != null && cell . getY ( ) - currentRow . getY ( ) < m_docInfo . getAverageLineGap ( ) / 2.0 ) currentRow . addCell ( cell ) ; else { /* * Creates a new row */ currentRow = new TableRow ( ) ; currentRow . setY ( cell . getY ( ) ) ; if ( cell . isSuperScriptBeginning ( ) ) currentRow . setSuperScriptRow ( true ) ; currentRow . addCell ( cell ) ; tc . addRow ( currentRow ) ; } } if ( tc . getRows ( ) . size ( ) < 2 ) tc . setValid ( false ) ; } | Organizes cells into rows based on the coordinate information | 436 | 10 |
20,738 | public void getRowHeadingBasedOnCells ( TableCandidate tc ) { String rowHeadingThisTable = "" ; int footnoteLineIndex = tc . getFootnoteBeginRow ( ) ; String [ ] [ ] cells = tc . getCells ( ) ; // if (cells[0][0].length()==0 ) { for ( int j = 0 ; j < footnoteLineIndex ; j ++ ) { if ( cells [ j ] [ 0 ] . length ( ) > 0 ) rowHeadingThisTable = rowHeadingThisTable + cells [ j ] [ 0 ] + "; " ; } // } rowHeadingThisTable = tc . replaceAllSpecialChracters ( rowHeadingThisTable ) ; tc . setHeadingRows ( rowHeadingThisTable ) ; } | Get the table row headings based on the cell information | 168 | 11 |
20,739 | public String getDeptype ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_deptype == null ) jcasType . jcas . throwFeatMissing ( "deptype" , "com.digitalpebble.rasp.Dependency" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_deptype ) ; } | getter for deptype - gets | 118 | 8 |
20,740 | public void setDeptype ( String v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_deptype == null ) jcasType . jcas . throwFeatMissing ( "deptype" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_deptype , v ) ; } | setter for deptype - sets | 121 | 8 |
20,741 | public String getSubtype ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_subtype == null ) jcasType . jcas . throwFeatMissing ( "subtype" , "com.digitalpebble.rasp.Dependency" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_subtype ) ; } | getter for subtype - gets | 114 | 7 |
20,742 | public void setSubtype ( String v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_subtype == null ) jcasType . jcas . throwFeatMissing ( "subtype" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_subtype , v ) ; } | setter for subtype - sets | 117 | 7 |
20,743 | public WordForm getDep ( ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_dep == null ) jcasType . jcas . throwFeatMissing ( "dep" , "com.digitalpebble.rasp.Dependency" ) ; return ( WordForm ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_dep ) ) ) ; } | getter for dep - gets | 133 | 6 |
20,744 | public void setDep ( WordForm v ) { if ( Dependency_Type . featOkTst && ( ( Dependency_Type ) jcasType ) . casFeat_dep == null ) jcasType . jcas . throwFeatMissing ( "dep" , "com.digitalpebble.rasp.Dependency" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Dependency_Type ) jcasType ) . casFeatCode_dep , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for dep - sets | 129 | 6 |
20,745 | public void setValue ( String v ) { if ( Lemma_Type . featOkTst && ( ( Lemma_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.Lemma" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Lemma_Type ) jcasType ) . casFeatCode_value , v ) ; } | setter for value - sets The value of lemma C | 115 | 12 |
20,746 | protected boolean trainCorpus ( List < List < Acronym > > corpus , List < Map < String , String > > trueLabels ) { boolean converge = false ; // Unsupervised trueLabels = null ; initModelParamsAndCounters ( ) ; int n = corpus . size ( ) ; int c = 1 ; Double change ; LOG . debug ( "Training abbreviations..." ) ; while ( ! converge ) { for ( int i = 0 ; i < n ; i ++ ) { List < Acronym > docAcronyms = corpus . get ( i ) ; Map < String , String > docTrueLabels = null ; if ( trueLabels != null ) docTrueLabels = trueLabels . get ( i ) ; int m = docAcronyms . size ( ) ; for ( int j = 0 ; j < m ; j ++ ) { Acronym currAcronym = docAcronyms . get ( j ) ; if ( trueLabels != null ) expectationStep ( currAcronym , docTrueLabels . get ( currAcronym . _shortForm ) ) ; else expectationStep ( currAcronym , null ) ; } } change = maximizationStep ( ) ; LOG . debug ( "step {}..." , c ) ; c ++ ; if ( c > MAX_ITERATIONS ) { System . out . println ( "\n\tTraining stopped after " + ( c - 1 ) + " iterations with final change: " + change ) ; converge = true ; } if ( change . compareTo ( CHANGE_THRESHOLD ) < 0 ) { LOG . debug ( "Training converged in " + ( c - 1 ) + " iterations." ) ; converge = true ; } } saveModelParams ( ) ; return true ; } | Gets training examples separated by documents | 387 | 7 |
20,747 | public String remove ( String txt ) { for ( Pattern p : patterns . keySet ( ) ) { System . out . println ( "p: " + p ) ; System . out . println ( "b: " + txt ) ; txt = p . matcher ( txt ) . replaceAll ( patterns . get ( p ) ) ; System . out . println ( "a: " + txt ) ; } return txt ; } | Takes a string and returns it without ligatures in it | 95 | 12 |
20,748 | public FSArray getValue ( ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; return ( FSArray ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) ) ) ; } | getter for value - gets Annotations to be chained . | 150 | 11 |
20,749 | public void setValue ( FSArray v ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for value - sets Annotations to be chained . | 146 | 11 |
20,750 | public Annotation getValue ( int i ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ) ) ; } | indexed getter for value - gets an indexed value - Annotations to be chained . | 225 | 17 |
20,751 | public void setValue ( int i , Annotation v ) { if ( DiscontinuousAnnotation_Type . featOkTst && ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeat_value == null ) jcasType . jcas . throwFeatMissing ( "value" , "de.julielab.jules.types.DiscontinuousAnnotation" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i ) ; jcasType . ll_cas . ll_setRefArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( DiscontinuousAnnotation_Type ) jcasType ) . casFeatCode_value ) , i , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | indexed setter for value - sets an indexed value - Annotations to be chained . | 222 | 17 |
20,752 | public int getDocumentSize ( ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_documentSize == null ) jcasType . jcas . throwFeatMissing ( "documentSize" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_documentSize ) ; } | getter for documentSize - gets Size of original document in bytes before processing by CAS Initializer . Either absolute file size of size within file or other source . | 117 | 32 |
20,753 | public void setDocumentSize ( int v ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_documentSize == null ) jcasType . jcas . throwFeatMissing ( "documentSize" , "org.apache.uima.examples.SourceDocumentInformation" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_documentSize , v ) ; } | setter for documentSize - sets Size of original document in bytes before processing by CAS Initializer . Either absolute file size of size within file or other source . | 120 | 32 |
20,754 | public boolean getLastSegment ( ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; return jcasType . ll_cas . ll_getBooleanValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_lastSegment ) ; } | getter for lastSegment - gets For a CAS that represents a segment of a larger source document this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document . | 122 | 60 |
20,755 | public void setLastSegment ( boolean v ) { if ( SourceDocumentInformation_Type . featOkTst && ( ( SourceDocumentInformation_Type ) jcasType ) . casFeat_lastSegment == null ) jcasType . jcas . throwFeatMissing ( "lastSegment" , "org.apache.uima.examples.SourceDocumentInformation" ) ; jcasType . ll_cas . ll_setBooleanValue ( addr , ( ( SourceDocumentInformation_Type ) jcasType ) . casFeatCode_lastSegment , v ) ; } | setter for lastSegment - sets For a CAS that represents a segment of a larger source document this flag indicates whether this CAS is the final segment of the source document . This is useful for downstream components that want to take some action after having seen all of the segments of a particular source document . | 125 | 60 |
20,756 | public String getLemma ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_lemma ) ; } | getter for lemma - gets lemma of the Form | 114 | 12 |
20,757 | public void setLemma ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_lemma == null ) jcasType . jcas . throwFeatMissing ( "lemma" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_lemma , v ) ; } | setter for lemma - sets lemma of the Form | 117 | 12 |
20,758 | public String getPOS ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_POS == null ) jcasType . jcas . throwFeatMissing ( "POS" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_POS ) ; } | getter for POS - gets POS tag for a given form | 109 | 12 |
20,759 | public void setPOS ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_POS == null ) jcasType . jcas . throwFeatMissing ( "POS" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_POS , v ) ; } | setter for POS - sets POS tag for a given form | 112 | 12 |
20,760 | public String getSuffix ( ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_suffix == null ) jcasType . jcas . throwFeatMissing ( "suffix" , "com.digitalpebble.rasp.WordForm" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_suffix ) ; } | getter for suffix - gets | 114 | 6 |
20,761 | public void setSuffix ( String v ) { if ( WordForm_Type . featOkTst && ( ( WordForm_Type ) jcasType ) . casFeat_suffix == null ) jcasType . jcas . throwFeatMissing ( "suffix" , "com.digitalpebble.rasp.WordForm" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( WordForm_Type ) jcasType ) . casFeatCode_suffix , v ) ; } | setter for suffix - sets | 117 | 6 |
20,762 | public static void serializeXMLDocument ( Document doc , Writer output ) throws TransformerException { // serialize XML document using identity transformation Transformer trans = TransformerFactory . newInstance ( ) . newTransformer ( ) ; DOMSource source = new DOMSource ( doc ) ; StreamResult result = new StreamResult ( output ) ; trans . transform ( source , result ) ; } | Writes the given Document to the given Writer using a no - op XSL transformation . | 79 | 18 |
20,763 | private FeatureIndex [ ] createFeatureIndex ( int subspaceCount ) // throws // Exception { logger . info ( "create feature index" ) ; FeatureIndex [ ] index = new FeatureIndex [ subspaceCount ] ; for ( int i = 0 ; i < subspaceCount ; i ++ ) index [ i ] = new FeatureIndex ( false , 1 ) ; return index ; } | create feature index | 79 | 3 |
20,764 | private static String annotatateContent ( JCas jcas , Object contentObj , int start ) { LOG . trace ( "annotate: " + reflectionToString ( contentObj ) ) ; int end = start ; StringBuilder internalSb = new StringBuilder ( ) ; if ( contentObj instanceof String ) { String c = ( String ) contentObj ; internalSb . append ( c ) ; end += c . length ( ) ; } else if ( contentObj instanceof Cons ) { Cons cons = ( Cons ) contentObj ; for ( Object o : cons . getContent ( ) ) { String parse = annotatateContent ( jcas , o , end ) ; end += parse . length ( ) ; internalSb . append ( parse ) ; } BioEntityMention entity = new BioEntityMention ( jcas , start , end ) ; entity . setSpecificType ( cons . getSem ( ) ) ; entity . setComponentId ( GeniaCorpusCollectionReader . COMPONENT_ID ) ; entity . setTextualRepresentation ( cons . getLex ( ) ) ; entity . addToIndexes ( ) ; } return internalSb . toString ( ) ; } | Recursive since annotations can overlap | 250 | 6 |
20,765 | public static Collection < BioEntityMention > getProteins ( Collection < BioEntityMention > mentions ) { ArrayList < BioEntityMention > ret = new ArrayList < BioEntityMention > ( ) ; for ( BioEntityMention mention : mentions ) { if ( mention . getSpecificType ( ) != null && mention . getSpecificType ( ) . startsWith ( "G#protein" ) ) ret . add ( mention ) ; } return ret ; } | Filters mentions that are proteins | 99 | 6 |
20,766 | public float getNormalizedValue ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_normalizedValue == null ) jcasType . jcas . throwFeatMissing ( "normalizedValue" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_normalizedValue ) ; } | getter for normalizedValue - gets | 116 | 7 |
20,767 | public void setNormalizedValue ( float v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_normalizedValue == null ) jcasType . jcas . throwFeatMissing ( "normalizedValue" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_normalizedValue , v ) ; } | setter for normalizedValue - sets | 119 | 7 |
20,768 | public float getRangeStartValue ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_rangeStartValue == null ) jcasType . jcas . throwFeatMissing ( "rangeStartValue" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_rangeStartValue ) ; } | getter for rangeStartValue - gets | 116 | 8 |
20,769 | public void setRangeStartValue ( float v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_rangeStartValue == null ) jcasType . jcas . throwFeatMissing ( "rangeStartValue" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_rangeStartValue , v ) ; } | setter for rangeStartValue - sets | 119 | 8 |
20,770 | public float getRangeEndValue ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_rangeEndValue == null ) jcasType . jcas . throwFeatMissing ( "rangeEndValue" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_rangeEndValue ) ; } | getter for rangeEndValue - gets | 116 | 8 |
20,771 | public void setRangeEndValue ( float v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_rangeEndValue == null ) jcasType . jcas . throwFeatMissing ( "rangeEndValue" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_rangeEndValue , v ) ; } | setter for rangeEndValue - sets | 119 | 8 |
20,772 | public float getMeanValue ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_meanValue == null ) jcasType . jcas . throwFeatMissing ( "meanValue" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_meanValue ) ; } | getter for meanValue - gets | 113 | 7 |
20,773 | public void setMeanValue ( float v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_meanValue == null ) jcasType . jcas . throwFeatMissing ( "meanValue" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_meanValue , v ) ; } | setter for meanValue - sets | 116 | 7 |
20,774 | public float getStandardErrorValue ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_standardErrorValue == null ) jcasType . jcas . throwFeatMissing ( "standardErrorValue" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_standardErrorValue ) ; } | getter for standardErrorValue - gets | 116 | 8 |
20,775 | public void setStandardErrorValue ( float v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_standardErrorValue == null ) jcasType . jcas . throwFeatMissing ( "standardErrorValue" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setFloatValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_standardErrorValue , v ) ; } | setter for standardErrorValue - sets | 119 | 8 |
20,776 | public String getUnit ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_unit == null ) jcasType . jcas . throwFeatMissing ( "unit" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_unit ) ; } | getter for unit - gets iso | 108 | 7 |
20,777 | public void setUnit ( String v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_unit == null ) jcasType . jcas . throwFeatMissing ( "unit" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_unit , v ) ; } | setter for unit - sets iso | 111 | 7 |
20,778 | public String getNormalizedUnit ( ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_normalizedUnit == null ) jcasType . jcas . throwFeatMissing ( "normalizedUnit" , "ch.epfl.bbp.uima.types.Measure" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_normalizedUnit ) ; } | getter for normalizedUnit - gets iso | 116 | 8 |
20,779 | public void setNormalizedUnit ( String v ) { if ( Measure_Type . featOkTst && ( ( Measure_Type ) jcasType ) . casFeat_normalizedUnit == null ) jcasType . jcas . throwFeatMissing ( "normalizedUnit" , "ch.epfl.bbp.uima.types.Measure" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Measure_Type ) jcasType ) . casFeatCode_normalizedUnit , v ) ; } | setter for normalizedUnit - sets iso | 119 | 8 |
20,780 | public double getProbability ( int i ) { if ( TopicDistribution_Type . featOkTst && ( ( TopicDistribution_Type ) jcasType ) . casFeat_probability == null ) jcasType . jcas . throwFeatMissing ( "probability" , "ch.epfl.bbp.uima.types.TopicDistribution" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( TopicDistribution_Type ) jcasType ) . casFeatCode_probability ) , i ) ; return jcasType . ll_cas . ll_getDoubleArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( TopicDistribution_Type ) jcasType ) . casFeatCode_probability ) , i ) ; } | indexed getter for probability - gets an indexed value - | 198 | 12 |
20,781 | public void setProbability ( int i , double v ) { if ( TopicDistribution_Type . featOkTst && ( ( TopicDistribution_Type ) jcasType ) . casFeat_probability == null ) jcasType . jcas . throwFeatMissing ( "probability" , "ch.epfl.bbp.uima.types.TopicDistribution" ) ; jcasType . jcas . checkArrayBounds ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( TopicDistribution_Type ) jcasType ) . casFeatCode_probability ) , i ) ; jcasType . ll_cas . ll_setDoubleArrayValue ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( TopicDistribution_Type ) jcasType ) . casFeatCode_probability ) , i , v ) ; } | indexed setter for probability - sets an indexed value - | 202 | 12 |
20,782 | public void load ( File file , boolean ids ) throws IOException , FileNotFoundException { LineNumberReader in = new LineNumberReader ( new FileReader ( file ) ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { if ( ids ) put ( Integer . toString ( in . getLineNumber ( ) ) , line , line ) ; else put ( line , line ) ; } in . close ( ) ; } | Insert all lines in a file as items mapping to themselves . If ids is true then make the line number of an item its id . | 99 | 28 |
20,783 | public void loadAliases ( File file ) throws IOException , FileNotFoundException { LineNumberReader in = new LineNumberReader ( new FileReader ( file ) ) ; String line ; while ( ( line = in . readLine ( ) ) != null ) { String [ ] parts = line . split ( "\\t" ) ; for ( int j = 1 ; j < parts . length ; j ++ ) { put ( parts [ j ] , parts [ j ] , parts [ 0 ] ) ; } } in . close ( ) ; } | Load a file of identifiers each of which has multiple aliases . Each line is a list of tab - separated strings the first of which is the identifier the remainder of which are aliases . | 114 | 36 |
20,784 | public void put ( String id , StringWrapper toInsert , Object value ) { MyWrapper wrapper = asMyWrapper ( toInsert ) ; Token [ ] tokens = wrapper . getTokens ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { ArrayList stringsWithToken = ( ArrayList ) index . get ( tokens [ i ] ) ; if ( stringsWithToken == null ) index . put ( tokens [ i ] , ( stringsWithToken = new ArrayList ( ) ) ) ; stringsWithToken . add ( wrapper ) ; } map . put ( wrapper , value ) ; if ( id != null ) idMap . put ( wrapper , id ) ; distance = null ; // mark distance as "out of date" totalEntries ++ ; } | Insert a prepared string into the dictionary . | 164 | 8 |
20,785 | private void doLookup ( String id , StringWrapper toFind ) { // retrain if necessary if ( distance == null ) { distance = new MyTeacher ( ) . train ( distanceLearner ) ; } // used cached values if it's ok if ( lastLookup == toFind ) return ; closeMatches = new HashSet ( ) ; closestMatch = null ; distanceToClosestMatch = - Double . MAX_VALUE ; // lookup best match to wrapper MyWrapper wrapper = asMyWrapper ( toFind ) ; Token [ ] tokens = wrapper . getTokens ( ) ; for ( int i = 0 ; i < tokens . length ; i ++ ) { ArrayList stringsWithToken = ( ArrayList ) index . get ( tokens [ i ] ) ; if ( stringsWithToken != null && ( ( double ) stringsWithToken . size ( ) / totalEntries ) < maxFraction ) { for ( Iterator j = stringsWithToken . iterator ( ) ; j . hasNext ( ) ; ) { MyWrapper wj = ( MyWrapper ) j . next ( ) ; String wjId = ( String ) idMap . get ( wj ) ; //if (DEBUG) System.out.println("id:"+id+" wjId:"+wjId); if ( ! closeMatches . contains ( wj ) && ( wjId == null || ! wjId . equals ( id ) ) ) { double score = distance . score ( wrapper . getDistanceWrapper ( ) , wj . getDistanceWrapper ( ) ) ; if ( DEBUG ) System . out . println ( "score for " + wj + ": " + score ) ; //if (DEBUG) System.out.println(distance.explainScore(wrapper.getDistanceWrapper(),wj.getDistanceWrapper())); closeMatches . add ( wj ) ; if ( score >= distanceToClosestMatch ) { //if (DEBUG) System.out.println("closest so far"); distanceToClosestMatch = score ; closestMatch = wj ; } } } } } lastLookup = toFind ; } | Lookup a string in the dictionary cache result in closeMatches . | 459 | 14 |
20,786 | public Object lookup ( String id , String toFind ) { return lookup ( id , new MyWrapper ( toFind ) ) ; } | Lookup a string in the dictionary . | 28 | 8 |
20,787 | public Object lookup ( String id , StringWrapper toFind ) { doLookup ( id , toFind ) ; return closestMatch ; } | Lookup a prepared string in the dictionary . | 29 | 9 |
20,788 | private MyWrapper asMyWrapper ( StringWrapper w ) { if ( w instanceof MyWrapper ) return ( MyWrapper ) w ; else return new MyWrapper ( w . unwrap ( ) ) ; } | lazily convert to a MyWrapper | 48 | 9 |
20,789 | static public void main ( String [ ] argv ) throws IOException , FileNotFoundException { SoftDictionary m = new SoftDictionary ( ) ; System . out . println ( "loading..." ) ; m . loadAliases ( new File ( argv [ 0 ] ) ) ; System . out . println ( "loaded..." ) ; for ( int i = 1 ; i < argv . length ; i ++ ) { System . out . println ( "lookup: " + argv [ i ] ) ; String [ ] f = argv [ i ] . split ( ":" ) ; if ( f . length == 1 ) { System . out . println ( argv [ i ] + " => " + m . lookup ( argv [ i ] ) + " at " + m . lookupDistance ( argv [ i ] ) ) ; } else { System . out . println ( f [ 1 ] + " => " + m . lookup ( f [ 0 ] , f [ 1 ] ) + " at " + m . lookupDistance ( f [ 0 ] , f [ 1 ] ) ) ; } } } | Simple main for testing . | 235 | 5 |
20,790 | public int getId ( ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_id == null ) jcasType . jcas . throwFeatMissing ( "id" , "de.julielab.jules.types.muc7.Coref" ) ; return jcasType . ll_cas . ll_getIntValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_id ) ; } | getter for id - gets | 115 | 6 |
20,791 | public void setId ( int v ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_id == null ) jcasType . jcas . throwFeatMissing ( "id" , "de.julielab.jules.types.muc7.Coref" ) ; jcasType . ll_cas . ll_setIntValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_id , v ) ; } | setter for id - sets | 118 | 6 |
20,792 | public String getCorefType ( ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_corefType == null ) jcasType . jcas . throwFeatMissing ( "corefType" , "de.julielab.jules.types.muc7.Coref" ) ; return jcasType . ll_cas . ll_getStringValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_corefType ) ; } | getter for corefType - gets | 123 | 8 |
20,793 | public void setCorefType ( String v ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_corefType == null ) jcasType . jcas . throwFeatMissing ( "corefType" , "de.julielab.jules.types.muc7.Coref" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_corefType , v ) ; } | setter for corefType - sets | 126 | 8 |
20,794 | public Coref getRef ( ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.muc7.Coref" ) ; return ( Coref ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_ref ) ) ) ; } | getter for ref - gets | 138 | 6 |
20,795 | public void setRef ( Coref v ) { if ( Coref_Type . featOkTst && ( ( Coref_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.muc7.Coref" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( Coref_Type ) jcasType ) . casFeatCode_ref , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for ref - sets | 134 | 6 |
20,796 | public Annotation getRef ( ) { if ( ArgumentMention_Type . featOkTst && ( ( ArgumentMention_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.ArgumentMention" ) ; return ( Annotation ) ( jcasType . ll_cas . ll_getFSForRef ( jcasType . ll_cas . ll_getRefValue ( addr , ( ( ArgumentMention_Type ) jcasType ) . casFeatCode_ref ) ) ) ; } | getter for ref - gets Reference to the Annotation Object that acts as a argument here | 139 | 18 |
20,797 | public void setRef ( Annotation v ) { if ( ArgumentMention_Type . featOkTst && ( ( ArgumentMention_Type ) jcasType ) . casFeat_ref == null ) jcasType . jcas . throwFeatMissing ( "ref" , "de.julielab.jules.types.ArgumentMention" ) ; jcasType . ll_cas . ll_setRefValue ( addr , ( ( ArgumentMention_Type ) jcasType ) . casFeatCode_ref , jcasType . ll_cas . ll_getFSRef ( v ) ) ; } | setter for ref - sets Reference to the Annotation Object that acts as a argument here | 135 | 18 |
20,798 | public void setRole ( String v ) { if ( ArgumentMention_Type . featOkTst && ( ( ArgumentMention_Type ) jcasType ) . casFeat_role == null ) jcasType . jcas . throwFeatMissing ( "role" , "de.julielab.jules.types.ArgumentMention" ) ; jcasType . ll_cas . ll_setStringValue ( addr , ( ( ArgumentMention_Type ) jcasType ) . casFeatCode_role , v ) ; } | setter for role - sets the role of the argument | 119 | 11 |
20,799 | public String [ ] getTags ( String word ) { if ( caseSensitive ) { return ( String [ ] ) dictionary . get ( word ) ; } else { //System.err.println(java.util.Arrays.asList((String[]) dictionary.get(word.toLowerCase()))); return ( String [ ] ) dictionary . get ( word . toLowerCase ( ) ) ; } } | Returns a list of valid tags for the specified word . | 87 | 11 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.