@Override protected void execute(JobSettings settings) throws AnalysisEngineProcessException { dictionary = wordnet.getDictionary(); try (CsvInteractionWriter writer = new CsvInteractionWriter(outputFilename)) { final CsvInteractionReader reader = new CsvInteractionReader(inputFilename); writer.initialise(); reader.read( (i, a) -> { final Set<String> alternatives = getAlternativeWords(i.getWord()) .map(s -> s.trim().toLowerCase()) // We don't want any small words, they are too commons .filter(s -> s.length() > 2) // We don't want any phrases .filter(s -> s.indexOf(' ') == -1) .collect(Collectors.toSet()); // Add in whatever the user provided alternatives.addAll(a); writeRow(writer, i, alternatives); }); getMonitor().info("Interaction enhacement complete and written to {}", outputFilename); } catch (final IOException e) { throw new AnalysisEngineProcessException(e); } }
@Override protected void execute(JobSettings settings) throws AnalysisEngineProcessException { dictionary = wordnet.getDictionary(); try (CsvInteractionWriter writer = new CsvInteractionWriter(outputFilename)) { final CsvInteractionReader reader = new CsvInteractionReader(inputFilename); writer.initialise(); reader.read( (i, a) -> { final Set<String> alternatives = getAlternativeWords(i.getWord()) .map(s -> s.trim().toLowerCase()) // We don't want any small words, they are too commons .filter(s -> s.length() > 2) // We don't want any phrases .filter(s -> s.indexOf(' ') == -1) .collect(Collectors.toSet()); // Add in whatever the user provided alternatives.addAll(a); writeRow(writer, i, alternatives); }); getMonitor().info("Interaction enhacement complete and written to {}", outputFilename); } catch (final IOException e) { throw new AnalysisEngineProcessException(e); } }
@Test public void testGetDictionary() { Assert.assertNotNull(wnr.getDictionary()); }