@Override public Sequence read() throws IOException { ChunkSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { POSSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = pcg.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } Sequence<POSSample> sequence = new Sequence<POSSample>(events,sample); return sequence; } return null; }
@Override public Sequence read() throws IOException { LemmaSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getTokens(); String[] tags = sample.getTags(); String[] preds = sample.getLemmas(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, preds); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { NameSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = seqCodec.encode(sample.getNames(), sentence.length); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context; if (useOutcomes) { context = pcg.getContext(i, sentence, tags, null); } else { context = pcg.getContext(i, sentence, null, null); } events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } else { return null; } }
@Override public Sequence read() throws IOException { ChunkSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { ChunkSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { POSSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = pcg.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } Sequence<POSSample> sequence = new Sequence<POSSample>(events,sample); return sequence; } return null; }
@Override public Sequence read() throws IOException { POSSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = sample.getTags(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = pcg.getContext(i, sentence, tags, null); events[i] = new Event(tags[i], context); } Sequence<POSSample> sequence = new Sequence<POSSample>(events,sample); return sequence; } return null; }
@Override public Sequence read() throws IOException { LemmaSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getTokens(); String[] tags = sample.getTags(); String[] preds = sample.getLemmas(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, preds); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { LemmaSample sample = samples.read(); if (sample != null) { String sentence[] = sample.getTokens(); String tags[] = sample.getTags(); String preds[] = sample.getLemmas(); Event[] events = new Event[sentence.length]; for (int i=0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, preds); events[i] = new Event(tags[i], context); } return new Sequence<LemmaSample>(events,sample); } return null; }
@Override public Sequence read() throws IOException { LemmaSample sample = samples.read(); if (sample != null) { String[] sentence = sample.getTokens(); String[] tags = sample.getTags(); String[] preds = sample.getLemmas(); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context = contextGenerator.getContext(i, sentence, tags, preds); events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } return null; }
@Override public Sequence read() throws IOException { NameSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = seqCodec.encode(sample.getNames(), sentence.length); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context; if (useOutcomes) { context = pcg.getContext(i, sentence, tags, null); } else { context = pcg.getContext(i, sentence, null, null); } events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } else { return null; } }
@Override public Sequence read() throws IOException { NameSample sample = psi.read(); if (sample != null) { String[] sentence = sample.getSentence(); String[] tags = seqCodec.encode(sample.getNames(), sentence.length); Event[] events = new Event[sentence.length]; for (int i = 0; i < sentence.length; i++) { // it is safe to pass the tags as previous tags because // the context generator does not look for non predicted tags String[] context; if (useOutcomes) { context = pcg.getContext(i, sentence, tags, null); } else { context = pcg.getContext(i, sentence, null, null); } events[i] = new Event(tags[i], context); } return new Sequence<>(events,sample); } else { return null; } }