Arria is the only language company in the world that makes its Natural Language Generation technologies available as microservices

Arria makes its core NLG technology available as microservices, breaking up the system used to build some of the most sophisticated NLG applications into smaller parts allowing you to integrate NLG functionality directly into your applications. This modularized approach to NLG development adds real business value by helping to drive delivery speed and development quality and safety.

Arria’s library of microservices include NLG functions that you can use to make the reports you generate sound like they were written by human experts.

Microservices also handle the low-level detail of English so you don’t have to. For example, use the aOrAn microservice to make your system choose the correct article – either “a” or “an” based on what the following word sounds like. Use the pluralNoun microservice, to turn “profit” to “profits” or “child” to “children”. Microservices make writing NLG systems easy.

Arria NLG Narrative APIs are available via the IBM Cloud >

Arria’s Microservices include the following NLG functions:

The aOrAn service determines whether to use “a” or “an” before a word, e.g. aOrAn with “umbrella” produces “an”, aOrAn with “ukulele” produces “a”.
Examples
  1. The end point returns a for the word university:

    Request URL: https://micro.arria.com/services/rest/english/aOrAn?word=university&apikey=

    Response: a

  2. The end point returns an error message if the word parameter is empty:

    Request URL: https://micro.arria.com/services/rest/english/aOrAn?word=&apikey=

    Response: IllegalArgumentException : The word parameter for aOrAn is invalid.

The countable service returns a noun phrase containing a number, an optional modifier and a noun. It pluralises the noun if the value of the number parameter is non singular and applies features to the number from an optional feature list.

The list of features for the countable service is:

Note:

  • The rounding feature can be used when the count parameter is a double.
  • The alpha and ordinal features can be used when the language is English.
Examples
  1. The end point returns a noun phrase with the number spelled out and the noun pluralised:

    Request URL: https://micro.arria.com/services/rest/english/countable?count=3&modifier=big&noun=apple&feature=isAlpha:true&apikey=

    Response: three big apples

  2. The end point returns a noun phrase with the number in ordinal form:

    Request URL: https://micro.arria.com/services/rest/english/countable?count=3&modifier=biggest&noun=tower&feature=isOrdinal:true&apikey=

    Response: 3rd biggest tower

  3. The end point returns a noun phrase with the Spanish locale:

    Request URL: https://micro.arria.com/services/rest/english/countable?count=10000&noun=animal&feature=language:es&feature=country:ES&apikey=

    Response: 10.000 animals

  4. The end point throws an exception if the noun parameter is null:

    Request URL: https://micro.arria.com/services/rest/english/countable?noun=&count=10000&feature=language:es&feature=country:ES&apikey=

    Response: IllegalArgumentException : Noun parameter is invalid.

The currency service returns a currency value for the input number with the input unit and form. By default, currencies are formatted in the US locale.

The table below shows the default patterns for each currency form. These may be overridden by supplying your own pattern as a value for the format feature.

Features for the currency service are listed below.

 
Examples
  1. The end point returns a currency value for the US locale in the SYMBOL form:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=33.55&apikey=

    Response: $33.55

  2. The end point returns a formatted currency value with the default pattern for the LONG form:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=33.567&unit=GBP&form=LONG&apikey=

    Response: 33.57 British pounds

  3. The end point returns a currency value with the suffix K (the number is greater than 1000):

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=GBP&form=SUFFIX&apikey=

    Response: £3.33K

  4. The end point returns a formatted currency value with the input format (the default SYMBOL format is overridden by the input format string ¤#,##0.0):

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=%%EDITORCONTENT%%amp;form=SYMBOL&feature=format:%C2%A4%23,%23%230.0&apikey=

    Response: $3,333.5

  5. The end point returns a currency value formatted using the Spanish locale:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=EUR&form=SYMBOL&feature=country:ES&feature=language:es&apikey=

    Response: €3.333,46

  6. The end point returns a currency value formatted using the input currency form:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=EUR&form=SYMBOL&apikey=

    Response: €3.333,46

  7. The end point returns a currency value formatted for SYMBOL with rounding type “down”:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=EUR&form=SYMBOL&feature=rounding:down&apikey=

    Response: €3,333.45

  8. The end point returns a currency value formatted using the input format and rounding to ceiling:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=%%EDITORCONTENT%%amp;form=SYMBOL&feature=format:%C2%A4%23,%23%230.0&feature=rounding:ceiling&apikey=

    Response: $3,333.5

  9. The end point returns a currency value formatted using the ACCOUNTING form with an input negative number:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=-3333.456&unit=%%EDITORCONTENT%%amp;form=ACCOUNTING&apikey=

    Response: ($3,333.46)

  10. The end point returns a currency formatted for UKPENCE and the £ unit:

    Request URL: https://micro.arria.com/services/rest/english/currency?number=3333.456&unit=£&form=UKPENCE&apikey=

    Response: 3,333p

The genderedPronoun service converts the input pronoun into the gender denoted by the value of the gender parameter.

Examples
  1. The end point returns the feminine form of the pronoun he:

    Request URL: https://micro.arria.com/services/rest/english/genderedPronoun?pronoun=he&gender=f&apikey=

    Response: she

  2. The end point returns an error message when the gender parameter is not a valid argument:

    Request URL: https://micro.arria.com/services/rest/english/genderedPronoun?pronoun=it&gender=masc&apikey=

    Response: IllegalArgumentException : Gender parameter is invalid.

  3. The end point returns an error message when pronoun parameter is empty:

    Request URL: https://micro.arria.com/services/rest/english/genderedPronoun?pronoun=&gender=m&apikey=

    Response: IllegalArgumentException : Pronoun parameter is invalid.

The list service takes an input list of items and applies list features to them. The default is to return the list items in the format A, B and C.

Provide the list of items by repeating the item parameter with successive values. For example, the list of items: item=A&item=B&… so on.
Features are supplied in the format “name:value”.
 
 
Examples
  1. The end point returns the items in the list with the default conjunction and:

    Request URL: https://micro.arria.com/services/rest/english/list?item=Google&item=Facebook&item=Microsoft&apikey=

    Response: Google, Facebook and Microsoft

  2. The end point with conjunction and separator features set:

    Request URL: https://micro.arria.com/services/rest/english/list?item=Raj&item=Ross&item=Pam&feature=conjunction:and&feature=separator:;&apikey=

    Response: Raj; Ross and Pam

  3. The end point returns an error message when pronoun parameter is empty:

    Request URL: https://micro.arria.com/services/rest/english/list?item=&apikey=

    Response: IllegalArgumentException : List item cannot be empty.

By default the pluralNoun service returns the the plural form of the input noun. If the count parameter is supplied, this will only pluralise when count is greater than one. It returns the singular form of the input noun if the value of the count parameter is “1”.

Examples
  1. The end point returns the default plural form of the noun:

    Request URL: https://micro.arria.com/services/rest/english/pluralNoun?noun=animal&apikey=

    Response: animals

  2. The end point returns the plural form of the noun if the count parameter is greater than one:

The pluralVerb service takes an input verb and returns either the third person present plural form of the verb (e.g. they “eat”) or the third person present singular form (e.g. he “eats”). The plural form will be used by default, or if the count is not “1”. If the count is “1” then the singular form will be used.

Examples
  1. The end point returns the third person present plural form of the input verb:

    Request URL: https://micro.arria.com/services/rest/english/pluralVerb?verb=works&apikey=

    Response: work

  2. The end point returns the third person present plural form of the input verb:

    Request URL: https://micro.arria.com/services/rest/english/pluralVerb?verb=ate&apikey=

    Response: eat

  3. The end point returns the third person present singular form of the input verb (e.g. he “writes”) because count is “1”:

    Request URL: https://micro.arria.com/services/rest/english/pluralVerb?verb=writes&count=1&apikey=

    Response: writes

  4. The end point returns an error message if the verb parameter is empty:

    Request URL: https://micro.arria.com/services/rest/english/pluralVerb?verb=&apikey=

    Response: IllegalArgumentException : Verb parameter is invalid.

The pronoun service returns a pronoun depending on combinations of the values of the parameters: plural, person, gender and type. All parameters are optional. If you do not supply any parameters to the pronoun end point, it returns the default value “it”.

Examples
  1. The end point with the pronoun parameters set to plural, 2nd person, male and reflexive:

    Request URL: https://micro.arria.com/services/rest/english/pronoun?plural=true&person=2&gender=m&type=refl&apikey=

    Response: yourselves

  2. The end point with the pronoun parameter set to plural (others are defaults):

    Request URL: https://micro.arria.com/services/rest/english/pronoun?plural=true&apikey=

    Response: they

  3. The end point returns an error message if a parameter value is not in the list of valid ones:

    Request URL: https://micro.arria.com/services/rest/english/pronoun?plural=true&person=2&gender=m&type=reflex&apikey=

    Response: IllegalArgumentException : Pronoun type is invalid.

The sentence service takes a string as a parameter and returns a sentence by capitalising the first letter, adding sentence-final punctuation where required.

Examples
  1. The end point returns a sentence:

    Request URL: https://micro.arria.com/services/rest/english/sentence?sentence=this+is+an+example+sentence&apikey=

    Response: This is an example sentence.

  2. The end point returns an error message if the sentence argument is invalid:

    Request URL: https://micro.arria.com/services/rest/english/sentence?sentence=&apikey=

    Response: IllegalArgumentException : Sentence parameter is invalid.

The spelledNumber service spells out integers e.g. for “3” and type “cardinal” it produces “three” and with type “ordinal” produces “third”. If you specify a limit, any number less than the limit will be spelled. For example, with a limit of 10, the number 9 will be spelled but the number 10 will not. Please note that spelledNumber outputs the result in English.

Examples
  1. The end point returns the default cardinal form of the input number:

    Request URL: https://micro.arria.com/services/rest/english/spelledNumber?number=26&apikey=

    Response: twenty-six

  2. The end point spells out the number in ordinal form:

    Request URL: https://micro.arria.com/services/rest/english/spelledNumber?number=20&type=ordinal&apikey=

    Response: twentieth

  3. The end point converts the number into ordinal form (it does not spell out the number because it is over the limit):

    Request URL: https://micro.arria.com/services/rest/english/spelledNumber?number=30&type=ordinal&limit=25&apikey=

    Response: 30th

  4. The end point returns an error message if the number argument is invalid:

    Request URL: https://micro.arria.com/services/rest/english/spelledNumber?number=number&apikey=

    Response: IllegalArgumentException : Number parameter is not a valid Integer.

The verbGroup service takes a head verb and an optional features list and returns a verb group that corresponds to the features that have been set. It returns the head verb in the present tense 3rd person singular form if no features are supplied.

Features that can be applied for a head verb are listed below.

Examples
  1. The end point returns a verb group for the features negation, passive and tense for the head verb break:

    Request URL: https://micro.arria.com/services/rest/english/verbGroup?head=break&feature=passive:true&feature=negated:true&feature=tense:future&apikey=

    Response: will not be broken

  2. The end point returns a verb group for for the feature infinitive:

    Request URL: https://micro.arria.com/services/rest/english/verbGroup?head=eat&feature=form:infinitive&apikey=

    Response: to eat

  3. The end point returns a head verb in the present tense third person singular form:

    Request URL: https://micro.arria.com/services/rest/english/verbGroup?head=broke&apikey=

    Response: breaks

  4. The end point returns an error message if the head verb is empty:

    Request URL: https://micro.arria.com/services/rest/english/verbGroup?head=&apikey=

    Response: IllegalArgumentException : Verb parameter in verbGroup method is invalid


© 2012-2018 ARRIA NLG plc. All rights reserved.

Top