Skip to content
Alessio Palmero Aprosio edited this page Apr 18, 2018 · 5 revisions

The simpatico-adaptation-engines TAE can be run using the SimpaticoApplication class. By default, the class load the values included in application.properties and in simpatico-default.props files.

The first one (application.properties) contains settings used by the webserver. The second one (simpatico-default.props) is used by the TAE (former dashboard). If the config.file property is filled in the application.properties file, the specified path is loaded after the default properties file.

The properties file can contain:

  • supportedLanguages: a list of comma-separated supported languages (for example, en, it, es).
  • ml_address: the address of TWM language guesser (see this website for more information).
  • ml_min_confidence: confidence for the language guesser.

Then you can configure the settings for the languages, using the format XX.property, where XX is the language and property is the Stanford CoreNLP property. You can use all as the language name to set a property for all languages.

Call the API

Input data has to be in JSON format. This is the list of accepted parameters:

  • text: the sentence in plain text format (required).
  • lang: two-letter code for the language (guessed if missing).
  • position: offset of the word(s) that needs to be simplified.
  • endOffset: final offset (in case of phrase). If missing, a single word is considered (starting from position).

The output is a JSON with the following properties:

  • text: the input text.
  • readability: a set of linguistic measures that give information about the text difficulty.
  • isSyntSimplified: a boolean value, true if the syntactic simplified version is different from the original text.
  • syntSimplifiedVersion: result of the syntactic simplification module.
  • linkings: a set of spans linked to Wikipedia.
  • simplifications: a set of spans where lexical simplification is applied.
  • sentences: array of annotated sentences in Stanford JSON format.

Example:

{
  "text": "The brown fox jumps over a lazy dog.\n\n",
  "readability": {
    "language": "en",
    "contentWordSize": 5,
    "contentEasyWordSize": 3,
    "wordCount": 8,
    "docLenWithSpaces": 38,
    "docLenWithoutSpaces": 29,
    "docLenLettersOnly": 28,
    "sentenceCount": 1,
    "tokenCount": 9,
    "hyphenCount": 6,
    "hyphenWordCount": 6,
    "ttrValue": 1.0,
    "density": 0.625,
    "subordinateRatio": 0.0,
    "forms": {},
    "measures": {
      "flesch-kincaid": -0.6699999999999982,
      "main": 114.11500000000001,
      "level1": 20.0,
      "level3": 100.0,
      "level2": 80.0
    },
    "labels": {
      "main": "Flesch"
    },
    "minYellowValues": {
      "ttrValue": 0.549,
      "deepMax": 9.0,
      "density": 0.566,
      "deepAvg": 5.292
    },
    "maxYellowValues": {
      "ttrValue": 0.719,
      "deepMax": 12.0,
      "density": 0.566,
      "deepAvg": 6.532
    },
    "minValues": {
      "ttrValue": 0.0,
      "deepMax": 0.0,
      "density": 0.0,
      "deepAvg": 0.0
    },
    "maxValues": {
      "ttrValue": 1.0,
      "deepMax": 20.0,
      "density": 1.0,
      "deepAvg": 10.0
    },
    "genericPosDescription": {
      "CC": "Conjunction",
      "CD": "Number",
      "PDT": "Pre-determiner",
      "D": "Determiner",
      "IN": "Subordinating (prep. or conj.)",
      "F": "Foreign word",
      "J": "Adjective",
      "L": "List item marker",
      "N": "Noun",
      "P": "Pronoun",
      "R": "Adverb",
      "POS": "Possessive",
      "U": "Interjection",
      "V": "Verb",
      "W": "Wh-stuff",
      "X": "Punctuation",
      "TO": "To"
    },
    "posDescription": {},
    "tooLongSentences": [],
    "posStats": {
      "support": {
        "DT": 2,
        "JJ": 2,
        "NN": 2,
        "IN": 1,
        ".": 1,
        "VBZ": 1
      }
    },
    "genericPosStats": {
      "support": {
        "D": 2,
        "IN": 1,
        "V": 1,
        "X": 1,
        "J": 2,
        "N": 2
      }
    }
  },
  "simplifications": [
    {
      "start": 14,
      "end": 19,
      "simplification": "drops",
      "originalValue": "jumps"
    }
  ],
  "linkings": [
    {
      "offset": 32,
      "page": "https://wikipedia.org/wiki/Dog",
      "score": 1.0,
      "originalText": "dog",
      "length": 3,
      "source": "ml-annotate",
      "spotted": true,
      "image": "http://upload.wikimedia.org/wikipedia/commons/2/26/YellowLabradorLooking_new.jpg",
      "types": {
        "DBPEDIA": [
          "Mammal",
          "Animal",
          "Eukaryote",
          "Species"
        ]
      }
    },
    {
      "offset": 10,
      "page": "https://wikipedia.org/wiki/Fox",
      "score": 0.9822381089343524,
      "originalText": "fox",
      "length": 3,
      "source": "ml-annotate",
      "spotted": true,
      "image": "http://upload.wikimedia.org/wikipedia/commons/f/fd/Fuzzy_Freddy.jpg",
      "types": {
        "DBPEDIA": [
          "Mammal",
          "Animal",
          "Eukaryote",
          "Species"
        ]
      }
    }
  ],
  "syntSimplifiedVersion": "The brown fox jumps over a lazy dog.\n",
  "isSyntSimplified": false,
  "sentences": [
    {
      "index": 0,
      "characterOffsetBegin": 0,
      "characterOffsetEnd": 36,
      "text": "The brown fox jumps over a lazy dog.",
      "parse": "SENTENCE_SKIPPED_OR_UNPARSABLE",
      "tokens": [
        {
          "index": 1,
          "word": "The",
          "originalText": "The",
          "lemma": "the",
          "characterOffsetBegin": 0,
          "characterOffsetEnd": 3,
          "pos": "DT",
          "before": "",
          "after": " ",
          "contentWord": false,
          "literalWord": true,
          "hyphenation": "The"
        },
        {
          "index": 2,
          "word": "brown",
          "originalText": "brown",
          "lemma": "brown",
          "characterOffsetBegin": 4,
          "characterOffsetEnd": 9,
          "pos": "JJ",
          "before": " ",
          "after": " ",
          "contentWord": true,
          "literalWord": true,
          "hyphenation": "brown"
        },
        {
          "index": 3,
          "word": "fox",
          "originalText": "fox",
          "lemma": "fox",
          "characterOffsetBegin": 10,
          "characterOffsetEnd": 13,
          "pos": "NN",
          "before": " ",
          "after": " ",
          "contentWord": true,
          "literalWord": true,
          "hyphenation": "fox",
          "linking": {
            "offset": 10,
            "page": "https://wikipedia.org/wiki/Fox",
            "score": 0.9822381089343524,
            "originalText": "fox",
            "length": 3,
            "source": "ml-annotate",
            "spotted": true,
            "image": "http://upload.wikimedia.org/wikipedia/commons/f/fd/Fuzzy_Freddy.jpg",
            "types": {
              "DBPEDIA": [
                "Mammal",
                "Animal",
                "Eukaryote",
                "Species"
              ]
            }
          }
        },
        {
          "index": 4,
          "word": "jumps",
          "originalText": "jumps",
          "lemma": "jump",
          "characterOffsetBegin": 14,
          "characterOffsetEnd": 19,
          "pos": "VBZ",
          "before": " ",
          "after": " ",
          "contentWord": true,
          "literalWord": true,
          "hyphenation": "jumps",
          "simplifiedVersion": "drops"
        },
        {
          "index": 5,
          "word": "over",
          "originalText": "over",
          "lemma": "over",
          "characterOffsetBegin": 20,
          "characterOffsetEnd": 24,
          "pos": "IN",
          "before": " ",
          "after": " ",
          "contentWord": false,
          "literalWord": true,
          "hyphenation": "over"
        },
        {
          "index": 6,
          "word": "a",
          "originalText": "a",
          "lemma": "a",
          "characterOffsetBegin": 25,
          "characterOffsetEnd": 26,
          "pos": "DT",
          "before": " ",
          "after": " ",
          "contentWord": false,
          "literalWord": true,
          "hyphenation": "a"
        },
        {
          "index": 7,
          "word": "lazy",
          "originalText": "lazy",
          "lemma": "lazy",
          "characterOffsetBegin": 27,
          "characterOffsetEnd": 31,
          "pos": "JJ",
          "before": " ",
          "after": " ",
          "contentWord": true,
          "literalWord": true,
          "hyphenation": "lazy"
        },
        {
          "index": 8,
          "word": "dog",
          "originalText": "dog",
          "lemma": "dog",
          "characterOffsetBegin": 32,
          "characterOffsetEnd": 35,
          "pos": "NN",
          "before": " ",
          "after": "",
          "contentWord": true,
          "literalWord": true,
          "hyphenation": "dog",
          "linking": {
            "offset": 32,
            "page": "https://wikipedia.org/wiki/Dog",
            "score": 1.0,
            "originalText": "dog",
            "length": 3,
            "source": "ml-annotate",
            "spotted": true,
            "image": "http://upload.wikimedia.org/wikipedia/commons/2/26/YellowLabradorLooking_new.jpg",
            "types": {
              "DBPEDIA": [
                "Mammal",
                "Animal",
                "Eukaryote",
                "Species"
              ]
            }
          }
        },
        {
          "index": 9,
          "word": ".",
          "originalText": ".",
          "lemma": ".",
          "characterOffsetBegin": 35,
          "characterOffsetEnd": 36,
          "pos": ".",
          "before": "",
          "after": "\n\n",
          "contentWord": false,
          "literalWord": false,
          "hyphenation": "."
        }
      ],
      "syntSimplifiedVersion": "The brown fox jumps over a lazy dog.",
      "isSyntSimplified": false
    }
  ]
}
Clone this wiki locally