Package net.sourceforge.segment

Examples of net.sourceforge.segment.TextIterator


  }

  @Override
  public final List<String> tokenize(final String text) {
    final List<String> segments = new ArrayList<>();
    final TextIterator textIterator = new SrxTextIterator(document, languageCode + parCode, text);
    while (textIterator.hasNext()) {
      segments.add(textIterator.next());
    }
    return segments;
  }
View Full Code Here


    this.document = parser.parse(reader);
    this.languageCode = languageCode;
  }
 
  public List<String> split(String string) {
    TextIterator textIterator =
      new SrxTextIterator(document, languageCode, string);
    List<String> segmentList = new ArrayList<String>();
    while(textIterator.hasNext()) {
      String segment = textIterator.next();
      segmentList.add(segment);
    }
    return segmentList;
    }
View Full Code Here

  public void testMaxLookbehindConstructLength() {
    Map<String, Object> parameterMap = new HashMap<String, Object>();
    parameterMap.put(SrxTextIterator.MAX_LOOKBEHIND_CONSTRUCT_LENGTH_PARAMETER, 2);
   
    String text = merge(MAX_LOOKBEHIND_CONSTRUCT_LENGTH_RESULT);
    TextIterator textIterator =
      new SrxTextIterator(MAX_LOOKBEHIND_CONSTRUCT_LENGTH_DOCUMENT,
          "", text, parameterMap);
    List<String> segmentList = segment(textIterator);
    String[] segmentArray = segmentList.toArray(new String[segmentList.size()]);
View Full Code Here

  private void performTest(String[] expectedResult,
      SrxDocument document, String languageCode) {
   
    String text = merge(expectedResult);
   
    TextIterator textIterator;
    List<String> segmentList;
   
    textIterator = getTextIterator(text, document, languageCode);
    segmentList = segment(textIterator);
   
View Full Code Here

      System.out.println("Segmenting... ");
    }

    long start = System.currentTimeMillis();

    TextIterator textIterator = createTextIterator(commandLine,
        document, reader, profile);

    performSegment(commandLine, textIterator, writer, profile);
   
    if (profile) {
View Full Code Here

  }
 
  private TextIterator createTextIterator(CommandLine commandLine,
      SrxDocument document, Reader reader, boolean profile) {
   
    TextIterator textIterator;
   
    String languageCode = commandLine.getOptionValue('l');
    if (languageCode == null) {
      languageCode = "";
    }
View Full Code Here

    }
  }

  static List<String> tokenize(String text, SrxDocument srxDocument, String code) {
    List<String> segments = new ArrayList<>();
    TextIterator textIterator = new SrxTextIterator(srxDocument, code, text);
    while (textIterator.hasNext()) {
      segments.add(textIterator.next());
    }
    return segments;
  }
View Full Code Here

TOP

Related Classes of net.sourceforge.segment.TextIterator

Copyright © 2018 www.massapicom. 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.