Class SentenceTagger


  • public class SentenceTagger
    extends Object
    Tags scope or cue in a single sentence
    Author:
    shashank
    • Constructor Detail

      • SentenceTagger

        public SentenceTagger()
    • Method Detail

      • tag

        public static AnnotatedSentence tag​(Annotator annotator,
                                            String sentence,
                                            boolean isTokenized)
        Tags the given sentence with the given annotator
        Parameters:
        annotator -
        sentence -
        isTokenized -
        Returns:
      • usage

        public static void usage()
        Prints the usage for the sentence tagger
      • getStringListFromAnnotatedSentences

        public static List<String> getStringListFromAnnotatedSentences​(List<AnnotatedSentence> annotatedSentences)
        Given a list of annotated sentences, return a list where the annotated sentences are replaced with strings
        Parameters:
        annotatedSentences -
        Returns:
      • getStringList

        public static List<String> getStringList​(String inputFile,
                                                 boolean isAnnotated)
        Gets the list of sentences in string format from the given inputFile.
        Parameters:
        inputFile - the file containing input sentences
        isAnnotated - set this as true if the input file contains annotated sentences. Set this as false if the input file contains only sentences as strings
        Returns:
        the list of sentences in string format in the given inputFile
      • getAnnotator

        public static Annotator getAnnotator​(String classifierType,
                                             String markType)
        Gets the Annotator from the given classifier and mark type
        Parameters:
        classifierType - such as "baseline", "crf", or "negex"
        markType -
        Returns:
      • main

        public static void main​(String[] args)
        Parameters:
        args - 0 - Annotator type ("cue" or "scope") 1 - Model type ("crf", "baseline" or "negex") 2 - Saved model file 3 - Sentence to tag