Skip to content

Commit 15ff023

Browse files
committed
Final changes to BasicTextAnnotationBuilder.java for pre-tokenization to work in ccg_nlpy
1 parent 5b2a930 commit 15ff023

File tree

1 file changed

+4
-26
lines changed

1 file changed

+4
-26
lines changed

core-utilities/src/main/java/edu/illinois/cs/cogcomp/annotation/BasicTextAnnotationBuilder.java

Lines changed: 4 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,16 @@ public static TextAnnotation createTextAnnotationFromTokens(List<String[]> token
4343

4444

4545
/**
46-
* The default way to create a {@link TextAnnotation} from pre-tokenized text.
46+
* A way to create a {@link TextAnnotation} from pre-tokenized text from Python
4747
*
48-
* @param tokenizedSentences A list of sentences, each one being an array of tokens
48+
* @param tokenizedSentences A list of sentences, each one being an list of tokens
4949
* @return A {@link TextAnnotation} containing the SENTENCE and TOKENS views.
5050
*/
5151
public static TextAnnotation createTextAnnotationFromListofListofTokens(List<List<Object>> tokenizedSentences) {
52-
// Function name is not createTextAnnotationFromTokens - due to same erasure error
52+
// This function takes List<List<Object>> to be able to run with cogcomp-nlpy (using pyjnius)
5353
// Convert the inner lists to String arrays
5454
// Call the default TextAnnotation builder function
55+
5556
List<String[]> tokenizedSentences_formatted = new ArrayList<String[]>();
5657

5758
// Converting inner list to array
@@ -69,29 +70,6 @@ public static TextAnnotation createTextAnnotationFromListofListofTokens(List<Lis
6970
}
7071

7172

72-
73-
// /**
74-
// * The default way to create a {@link TextAnnotation} from pre-tokenized text.
75-
// *
76-
// * @param tokenizedSentences A list of sentences, each one being an array of tokens
77-
// * @return A {@link TextAnnotation} containing the SENTENCE and TOKENS views.
78-
// */
79-
// public static TextAnnotation createTextAnnotationFromListofListofTokens(List<List<String>> tokenizedSentences) {
80-
// // Function name is not createTextAnnotationFromTokens - due to same erasure error
81-
// // Convert the inner lists to String arrays
82-
// // Call the default TextAnnotation builder function
83-
// List<String[]> tokenizedSentences_formatted = new ArrayList<String[]>();
84-
//
85-
// // Converting inner list to array
86-
// for (List<String> sentence : tokenizedSentences) {
87-
// String[] sentence_array = (String[]) sentence.toArray();
88-
// tokenizedSentences_formatted.add(sentence_array);
89-
// }
90-
//
91-
// return createTextAnnotationFromTokens("", "", tokenizedSentences_formatted);
92-
// }
93-
94-
9573
/**
9674
* The default way to create a {@link TextAnnotation} from pre-tokenized text.
9775
*

0 commit comments

Comments
 (0)