Class StringParser

  • All Implemented Interfaces:
    Parser

    @Title("String Parser")
    @Description("Parses new line separated strings")
    public class StringParser
    extends java.lang.Object
    implements Parser
    Parser that loads a text file for use with string similarity measures. The parser produces two relations: the first of type String, the second of type label list, which contains the same data for convenience.
    Since:
    0.6.0
    Author:
    Felix Stahlberg, Erich Schubert
    • Nested Class Summary

      Nested Classes 
      Modifier and Type Class Description
      static class  StringParser.Par
      Parameterization class.
    • Field Summary

      Fields 
      Modifier and Type Field Description
      (package private) java.util.regex.Matcher comment
      Comment pattern.
      (package private) boolean trimWhitespace
      Flag to trim whitespace.
    • Constructor Summary

      Constructors 
      Constructor Description
      StringParser​(java.util.regex.Pattern comment, boolean trimWhitespace)
      Constructor.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      void cleanup()
      Perform cleanup operations after parsing.
      MultipleObjectsBundle parse​(java.io.InputStream in)
      Returns a list of the objects parsed from the specified input stream.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • comment

        java.util.regex.Matcher comment
        Comment pattern.
      • trimWhitespace

        boolean trimWhitespace
        Flag to trim whitespace.
    • Constructor Detail

      • StringParser

        public StringParser​(java.util.regex.Pattern comment,
                            boolean trimWhitespace)
        Constructor.
        Parameters:
        comment - Pattern for comments.
        trimWhitespace - Trim leading and trailing whitespace.
    • Method Detail

      • parse

        public MultipleObjectsBundle parse​(java.io.InputStream in)
        Description copied from interface: Parser
        Returns a list of the objects parsed from the specified input stream.
        Specified by:
        parse in interface Parser
        Parameters:
        in - the stream to parse objects from
        Returns:
        a list containing those objects parsed from the input stream
      • cleanup

        public void cleanup()
        Description copied from interface: Parser
        Perform cleanup operations after parsing.
        Specified by:
        cleanup in interface Parser