Examples of BomStrippingInputStreamReader


Examples of gate.util.BomStrippingInputStreamReader

      gazStore = new GazStoreTrie3();     
    } else {
      throw new GateRuntimeException("Invalid backend number: "+backendNr);
    }
    BufferedReader defReader =
      new BomStrippingInputStreamReader((configFileURL).openStream(), encoding);
    String line;
    //logger.info("Loading data");
    while (null != (line = defReader.readLine())) {
       String[] fields = line.split(":");
       if(fields.length == 0) {
         System.err.println("Empty line in file "+configFileURL);
       } else {
         String listFileName = "";
         String majorType = "";
         String minorType = "";
         String languages = "";
         String annotationType = ANNIEConstants.LOOKUP_ANNOTATION_TYPE;
         listFileName = fields[0];
         if(fields.length > 1) {
           majorType = fields[1];
         }
         if(fields.length > 2) {
           minorType = fields[2];
         }
         if(fields.length > 3) {
           languages = fields[3];
         }
         if(fields.length > 4) {
           annotationType = fields[4];
         }
         if(fields.length > 5) {
           defReader.close();
           throw new GateRuntimeException("Line has more that 5 fields in def file "+configFileURL);
         }
         logger.debug("Reading from "+listFileName+", "+majorType+"/"+minorType+"/"+languages+"/"+annotationType);
         //logger.info("DEBUG: loading data from "+listFileName);
         loadListFile(listFileName,majorType,minorType,languages,annotationType);
      }
    } //while
    defReader.close();
    gazStore.compact();
    logger.info("Gazetteer loaded from list files");
   
    if(backendNr == 3 && useCache) {
      gazStore.save(gazbinFile);
View Full Code Here

Examples of gate.util.BomStrippingInputStreamReader

   
    // Always read the yaml file so we can get any special location of the cache
    // file or figure out that we should not try to load the cache file
    Yaml yaml = new Yaml();
    BufferedReader yamlReader =
        new BomStrippingInputStreamReader((configFileURL).openStream(), encoding);
    Object configObject = yaml.load(yamlReader);

    List<Map> configListFiles = null;
    if(configObject instanceof Map) {
      Map<String,Object> configMap = (Map<String,Object>)configObject;
View Full Code Here

Examples of gate.util.BomStrippingInputStreamReader

    //        languages, annotationType);
    BufferedReader listReader = null;
    if(listFileName.endsWith(".gz")) {
      listReader = new BufferedReader(new InputStreamReader(new GZIPInputStream(lurl.openStream()),encoding));
    } else {
      listReader = new BomStrippingInputStreamReader(lurl.openStream(), encoding);
    }
    String line;
    int lines = 0;
    String[] entryFeatures = new String[0];
    while (null != (line = listReader.readLine())) {
View Full Code Here

Examples of gate.util.BomStrippingInputStreamReader

  public Resource init() throws ResourceInstantiationException {
    // logger.warn("OpenNLP POS initializing strings are: model - " +
    // model.getFile() +
    // " dictionary: "+dictionary.getFile());
    try {
      BufferedReader dictionaryReader = new BomStrippingInputStreamReader(dictionary.openStream(),
              dictionaryEncoding);
      pos = new POSTaggerME(getModel(model), new POSDictionary(
          dictionaryReader, true));
    } catch (IOException e) {
      e.printStackTrace();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.