/** * Given an array of <code>String</code>s, this method creates a new * {@link LinkedVector} containing {@link Word}s. * * @param a An array of <code>String</code>s. * @return A {@link LinkedVector} of {@link Word}s corresponding to the * input <code>String</code>s. **/ public static LinkedVector convert(String[] a) { if (a == null) return null; if (a.length == 0) return new LinkedVector(); Word w = new Word(a[0]); for (int i = 1; i < a.length; ++i) { w.next = new Word(a[i], null, w); w = (Word) w.next; } return new LinkedVector(w); }
/** * Given an array of <code>String</code>s, this method creates a new * {@link LinkedVector} containing {@link Word}s. * * @param a An array of <code>String</code>s. * @return A {@link LinkedVector} of {@link Word}s corresponding to the * input <code>String</code>s. **/ public static LinkedVector convert(String[] a) { if (a == null) return null; if (a.length == 0) return new LinkedVector(); Word w = new Word(a[0]); for (int i = 1; i < a.length; ++i) { w.next = new Word(a[i], null, w); w = (Word) w.next; } return new LinkedVector(w); }
public static ArrayList<LinkedVector> parseText(String text) { Vector<Vector<String>> processed = sentenceSplitAndTokenizeText(text); ArrayList<LinkedVector> res = new ArrayList<>(); for (int i = 0; i < processed.size(); i++) { LinkedVector sentence = new LinkedVector(); for (int j = 0; j < processed.elementAt(i).size(); j++) NEWord.addTokenToSentence(sentence, processed.elementAt(i).elementAt(j), "unlabeled"); res.add(sentence); } TaggedDataReader.connectSentenceBoundaries(res); return res; }
public static ArrayList<LinkedVector> parseText(String text, ParametersForLbjCode cp) { Vector<Vector<String>> processed = sentenceSplitAndTokenizeText(text, cp); ArrayList<LinkedVector> res = new ArrayList<>(); for (int i = 0; i < processed.size(); i++) { LinkedVector sentence = new LinkedVector(); for (int j = 0; j < processed.elementAt(i).size(); j++) NEWord.addTokenToSentence(sentence, processed.elementAt(i).elementAt(j), "unlabeled", cp); res.add(sentence); } TaggedDataReader.connectSentenceBoundaries(res); return res; }
public static ArrayList<LinkedVector> parseText(String text, ParametersForLbjCode cp) { Vector<Vector<String>> processed = sentenceSplitAndTokenizeText(text, cp); ArrayList<LinkedVector> res = new ArrayList<>(); for (int i = 0; i < processed.size(); i++) { LinkedVector sentence = new LinkedVector(); for (int j = 0; j < processed.elementAt(i).size(); j++) NEWord.addTokenToSentence(sentence, processed.elementAt(i).elementAt(j), "unlabeled", cp); res.add(sentence); } TaggedDataReader.connectSentenceBoundaries(res); return res; }
|| tokens.length == 1 && (tokens[0] == null || tokens[0].length() == 0)) return new LinkedVector(); return new LinkedVector(w);
|| tokens.length == 1 && (tokens[0] == null || tokens[0].length() == 0)) return new LinkedVector(); return new LinkedVector(w);
if (input.trim().equals("")) { Vector<LinkedVector> v = new Vector<LinkedVector>(); v.addElement(new LinkedVector()); return new Data(new NERDocument(v, "empty"));
/** * Produces the next object parsed from the input file; in this case, that object is guaranteed * to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence. **/ public Object next() { String[] line = (String[]) super.next(); while (line != null && (line.length < 2 || line[4].equals("-X-"))) line = (String[]) super.next(); if (line == null) return null; if (line[3].charAt(0) == 'I') line[3] = "B" + line[3].substring(1); Token t = new Token(new Word(line[5], line[4]), null, line[3]); String previous = line[3]; for (line = (String[]) super.next(); line != null && line.length > 0; line = (String[]) super.next()) { if (line[3].charAt(0) == 'I' && !previous.endsWith(line[3].substring(2))) line[3] = "B" + line[3].substring(1); t.next = new Token(new Word(line[5], line[4]), t, line[3]); t = (Token) t.next; previous = line[3]; } return new LinkedVector(t); } }
/** * Produces the next object parsed from the input file; in this case, that object is guaranteed * to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence. **/ public Object next() { String[] line = (String[]) super.next(); while (line != null && (line.length < 2 || line[4].equals("-X-"))) line = (String[]) super.next(); if (line == null) return null; if (line[3].charAt(0) == 'I') line[3] = "B" + line[3].substring(1); Token t = new Token(new Word(line[5], line[4]), null, line[3]); String previous = line[3]; for (line = (String[]) super.next(); line != null && line.length > 0; line = (String[]) super.next()) { if (line[3].charAt(0) == 'I' && !previous.endsWith(line[3].substring(2))) line[3] = "B" + line[3].substring(1); t.next = new Token(new Word(line[5], line[4]), t, line[3]); t = (Token) t.next; previous = line[3]; } return new LinkedVector(t); } }
/** * Given a {@link LinkedVector} containing {@link Word}s, this method * creates a new {@link LinkedVector} containing {@link Token}s. * * @param v A {@link LinkedVector} of {@link Word}s. * @return A {@link LinkedVector} of {@link Token}s corresponding to the * input {@link Word}s. **/ public static LinkedVector convert(LinkedVector v) { if (v == null) return null; if (v.size() == 0) return v; Word w = (Word) v.get(0); Token t = new Token(w, null, null); for (w = (Word) w.next; w != null; w = (Word) w.next) { t.next = new Token(w, t, null); t = (Token) t.next; } return new LinkedVector(t); }
/** * Given a {@link LinkedVector} containing {@link Word}s, this method * creates a new {@link LinkedVector} containing {@link Token}s. * * @param v A {@link LinkedVector} of {@link Word}s. * @return A {@link LinkedVector} of {@link Token}s corresponding to the * input {@link Word}s. **/ public static LinkedVector convert(LinkedVector v) { if (v == null) return null; if (v.size() == 0) return v; Word w = (Word) v.get(0); Token t = new Token(w, null, null); for (w = (Word) w.next; w != null; w = (Word) w.next) { t.next = new Token(w, t, null); t = (Token) t.next; } return new LinkedVector(t); }
/** * This method returns {@link Token}s until the input is exhausted, at * which point it returns <code>null</code>. **/ public Object next() { while (next == null) { LinkedVector words = (LinkedVector) parser.next(); if (words == null) return null; Word w = (Word) words.get(0); Token t = new Token(w, null, null); for (w = (Word) w.next; w != null; w = (Word) w.next) { t.next = new Token(w, t, null); t = (Token) t.next; } LinkedVector tokens = new LinkedVector(t); next = (Token) tokens.get(0); } Token result = next; next = (Token) next.next; return result; }
/** * This method returns {@link Token}s until the input is exhausted, at * which point it returns <code>null</code>. **/ public Object next() { while (next == null) { LinkedVector words = (LinkedVector) parser.next(); if (words == null) return null; Word w = (Word) words.get(0); Token t = new Token(w, null, null); for (w = (Word) w.next; w != null; w = (Word) w.next) { t.next = new Token(w, t, null); t = (Token) t.next; } LinkedVector tokens = new LinkedVector(t); next = (Token) tokens.get(0); } Token result = next; next = (Token) next.next; return result; }
/** * Produces the next object parsed from the input file; in this case, that object is guaranteed * to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence. **/ public Object next() { String[] line = (String[]) super.next(); while (line != null && line.length == 0) line = (String[]) super.next(); if (line == null) return null; String pos = line[1]; if (pos.equals("-")) pos = null; Token t = new Token(new Word(line[0], pos), null, line[2]); for (line = (String[]) super.next(); line != null && line.length > 0; line = (String[]) super.next()) { pos = line[1]; if (pos.equals("-")) pos = null; t.next = new Token(new Word(line[0], pos), t, line[2]); t = (Token) t.next; } return new LinkedVector(t); } }
/** * Produces the next object parsed from the input file; in this case, that object is guaranteed * to be a <code>LinkedVector</code> populated by <code>Token</code>s representing a sentence. **/ public Object next() { String[] line = (String[]) super.next(); while (line != null && line.length == 0) line = (String[]) super.next(); if (line == null) return null; String pos = line[1]; if (pos.equals("-")) pos = null; Token t = new Token(new Word(line[0], pos), null, line[2]); for (line = (String[]) super.next(); line != null && line.length > 0; line = (String[]) super.next()) { pos = line[1]; if (pos.equals("-")) pos = null; t.next = new Token(new Word(line[0], pos), t, line[2]); t = (Token) t.next; } return new LinkedVector(t); } }
LinkedVector res = new LinkedVector(); NEWord w = new NEWord(new Word(token, pos), null, label); NEWord.addTokenToSentence(res, w.form, w.neLabel, params);
LinkedVector res = new LinkedVector(); NEWord w = new NEWord(new Word(token, pos), null, label); NEWord.addTokenToSentence(res, w.form, w.neLabel);
LinkedVector res = new LinkedVector(); NEWord w = new NEWord(new Word(token, pos), null, label); NEWord.addTokenToSentence(res, w.form, w.neLabel, params);
int sentstart = sentence.getStartSpan(); LinkedVector words = new LinkedVector();