Package org.apache.ctakes.ytex.uima.model

Examples of org.apache.ctakes.ytex.uima.model.SegmentRegex


   * @throws Exception
   */
  @Test
  public void testRegex() throws UIMAException, IOException {
    SegmentRegexAnnotator ner = new SegmentRegexAnnotator();
    SegmentRegex segTitle = new SegmentRegex();
    segTitle.setRegex("(?i)title:\\s*(.*)\\n");
    segTitle.setLimitToRegex(true);
    segTitle.setSegmentID("TITLE");
    segTitle.setSegmentRegexID(1);
    SegmentRegex segHistory = new SegmentRegex();
    segHistory.setRegex("(?i)history:");
    segHistory.setLimitToRegex(false);
    segHistory.setSegmentID("HISTORY");
    segHistory.setSegmentRegexID(2);
    ner.initRegexMap(Arrays.asList(segTitle, segHistory));

    JCas jCas = JCasFactory
        .createJCasFromPath("src/main/resources/org/apache/ctakes/ytex/types/TypeSystem.xml");
    String text = "Title: US Left Upper Quadrant\nDr. Doolitle asked patient\nto take a deep breath\nand exhale slowly.  \nHistory: Patient coughed.";
View Full Code Here

TOP

Related Classes of org.apache.ctakes.ytex.uima.model.SegmentRegex

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.