public CSVSentiment(String configurationFile) { decode = new NLPDecoder(IOUtils.createFileInputStream(configurationFile)); }
public CSVSentiment(String configurationFile) { decode = new NLPDecoder(IOUtils.createFileInputStream(configurationFile)); }
public DependencyParser() throws IOException { LOGGER.info("Loading Dependency Parsing model"); nlpDecoder = new NLPDecoder(); List<NLPComponent<NLPNode>> components = new ArrayList(); String modelPath = System.getProperty("user.dir") + "/models/dep/vi-dep.xz"; if (!new File(modelPath).exists()) throw new IOException("DependencyParser: " + modelPath + " is not found!"); components.add(NLPUtils.getComponent(modelPath)); nlpDecoder.setComponents(components); }
@SuppressWarnings("resource") public NLPSocketServer(InputStream configuration, int port, int threads) throws Exception { ExecutorService executor = Executors.newFixedThreadPool(threads); ServerSocket server = new ServerSocket(port); Socket client; decoder = new NLPDecoder(configuration); System.out.println("Listening..."); while (true) { client = server.accept(); executor.submit(new NLPTask(client)); } // executor.shutdown(); // server.close(); }
@SuppressWarnings("resource") public NLPSocketServer(InputStream configuration, int port, int threads) throws Exception { ExecutorService executor = Executors.newFixedThreadPool(threads); ServerSocket server = new ServerSocket(port); Socket client; decoder = new NLPDecoder(configuration); System.out.println("Listening..."); while (true) { client = server.accept(); executor.submit(new NLPTask(client)); } // executor.shutdown(); // server.close(); }
public NerRecognizer() throws IOException{ LOGGER.info("Loading NER model"); nlpDecoder = new NLPDecoder(); List<NLPComponent<NLPNode>> components = new ArrayList(); String modelPath = System.getProperty("user.dir") + "/models/ner/vi-ner.xz"; if (!new File(modelPath).exists()) throw new IOException("NerRecognizer: " + modelPath + " is not found!"); GlobalLexica lexica = LexicalInitializer.initialize(true).initializeLexica(); if(lexica != null) { components.add(lexica); } components.add(NLPUtils.getComponent(modelPath)); nlpDecoder.setComponents(components); }
public TokenizeIt(String configFile) { decoder = new NLPDecoder(IOUtils.createFileInputStream(configFile)); tokenizer = new EnglishTokenizer(); }
public TokenizeIt(String configFile) { decoder = new NLPDecoder(IOUtils.createFileInputStream(configFile)); tokenizer = new EnglishTokenizer(); }
public NLPDecode(String[] args) { BinUtils.initArgs(args, this); List<String> filelist = FileUtils.getFileList(input_path, input_ext, false); Collections.sort(filelist); decoder = new NLPDecoder(IOUtils.createFileInputStream(configuration_file)); decoder.decode(filelist, output_ext, format, threads); }
public NLPDecode(String[] args) { BinUtils.initArgs(args, this); List<String> filelist = FileUtils.getFileList(input_path, input_ext, false); Collections.sort(filelist); decoder = new NLPDecoder(IOUtils.createFileInputStream(configuration_file)); decoder.decode(filelist, output_ext, format, threads); }
static public void main(String[] args) throws Exception { final String configFile = "src/main/resources/edu/emory/mathcs/nlp/configuration/config-decode-en.xml"; final String inputFile = "src/test/resources/dat/nlp4j.txt"; NLPDecoder nlp4j = new NLPDecoder(IOUtils.createFileInputStream(configFile)); NLPNode[] nodes; String sentence = "John bought a car for Mary."; nodes = nlp4j.decode(sentence); System.out.println(Joiner.join(nodes, "\n", 1)+"\n"); nlp4j.decode(IOUtils.createFileInputStream(inputFile), System.out, AbstractNLPDecoder.FORMAT_RAW); } }
static public void main(String[] args) throws Exception { final String configFile = "src/main/resources/edu/emory/mathcs/nlp/configuration/config-decode-en.xml"; final String inputFile = "src/test/resources/dat/nlp4j.txt"; NLPDecoder nlp4j = new NLPDecoder(IOUtils.createFileInputStream(configFile)); NLPNode[] nodes; String sentence = "John bought a car for Mary."; nodes = nlp4j.decode(sentence); System.out.println(Joiner.join(nodes, "\n", 1)+"\n"); nlp4j.decode(IOUtils.createFileInputStream(inputFile), System.out, AbstractNLPDecoder.FORMAT_RAW); } }
static public void main(String[] args) throws Exception { final String configFile = "/Users/jdchoi/Documents/EmoryNLP/nlp4j/src/main/resources/edu/emory/mathcs/nlp/configuration/config-decode-deident.xml"; final String inputDir = "/Users/jdchoi/Desktop/radiology/Q2"; final String inputExt = "txt"; final String outputExt = "tsv"; final String outputFormat = AbstractNLPDecoder.FORMAT_LINE; NLPDecoder nlp4j = new NLPDecoder(IOUtils.createFileInputStream(configFile)); for (String inputFile : FileUtils.getFileList(inputDir, inputExt)) { System.out.println(inputFile); String outputFile = inputFile+"."+outputExt; nlp4j.decode(IOUtils.createFileInputStream(inputFile), IOUtils.createFileOutputStream(outputFile), outputFormat); } } }
static public void main(String[] args) throws Exception { final String configFile = "/Users/jdchoi/Documents/EmoryNLP/nlp4j/src/main/resources/edu/emory/mathcs/nlp/configuration/config-decode-deident.xml"; final String inputDir = "/Users/jdchoi/Desktop/radiology/Q2"; final String inputExt = "txt"; final String outputExt = "tsv"; final String outputFormat = AbstractNLPDecoder.FORMAT_LINE; NLPDecoder nlp4j = new NLPDecoder(IOUtils.createFileInputStream(configFile)); for (String inputFile : FileUtils.getFileList(inputDir, inputExt)) { System.out.println(inputFile); String outputFile = inputFile+"."+outputExt; nlp4j.decode(IOUtils.createFileInputStream(inputFile), IOUtils.createFileOutputStream(outputFile), outputFormat); } } }
NLPDecoder decoder = new NLPDecoder(decodeConfig);
NLPDecoder decoder = new NLPDecoder(decodeConfig);