Class ExampleBase

java.lang.Object
com.basistech.rosette.examples.ExampleBase
Direct Known Subclasses:
AddressSimilarityExample, CategoriesExample, EntitiesExample, EventsExample, InfoExample, LanguageExample, LanguageMultilingualExample, MorphologyCompleteExample, MorphologyCompoundComponentsExample, MorphologyHanReadingsExample, MorphologyLemmasExample, MorphologyPartsOfSpeechExample, NameDeduplicationExample, NameSimilarityExample, NameTranslationExample, PingExample, RelationshipsExample, SemanticVectorsExample, SentencesExample, SentimentExample, SimilarTermsExample, SyntaxDependenciesExample, TokensExample, TopicsExample, TransliterationExample

public abstract class ExampleBase extends Object
Provides examples on how to use the HttpRosetteAPI
  • Constructor Details

    • ExampleBase

      public ExampleBase()
  • Method Details

    • getApiKeyFromSystemProperty

      protected String getApiKeyFromSystemProperty()
      Returns:
      api key using system property "rosette.api.key"
    • getAltUrlFromSystemProperty

      protected String getAltUrlFromSystemProperty()
      Returns:
      alternate url using system property "rosette.api.altUrl"
    • showUsage

      protected static void showUsage(Class<? extends ExampleBase> commandClass)
      Prints out how to run the program
      Parameters:
      commandClass - the class to use in the usage message.
    • responseToJson

      protected static String responseToJson(com.basistech.rosette.apimodel.Response response) throws com.fasterxml.jackson.core.JsonProcessingException
      Converts a response to JSON string
      Parameters:
      response - Response from RosetteAPI
      Returns:
      the json string.
      Throws:
      com.fasterxml.jackson.core.JsonProcessingException - if the Jackson library throws an error serializing.