Symphony OpenNLP Client

Symphony OpenNLP Client provided by Symphony Platform Solutions team

Лицензия

Лицензия

Категории

Категории

Java Языки программирования ORM Данные
Группа

Группа

com.symphony.platformsolutions
Идентификатор

Идентификатор

symphony-opennlp-java
Последняя версия

Последняя версия

1.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

Symphony OpenNLP Client
Symphony OpenNLP Client provided by Symphony Platform Solutions team
Ссылка на сайт

Ссылка на сайт

https://github.com/SymphonyPlatformSolutions/symphony-opennlp-java
Система контроля версий

Система контроля версий

https://github.com/SymphonyPlatformSolutions/symphony-opennlp-java

Скачать symphony-opennlp-java

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/com.symphony.platformsolutions/symphony-opennlp-java/ -->
<dependency>
    <groupId>com.symphony.platformsolutions</groupId>
    <artifactId>symphony-opennlp-java</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/com.symphony.platformsolutions/symphony-opennlp-java/
implementation 'com.symphony.platformsolutions:symphony-opennlp-java:1.0.2'
// https://jarcasting.com/artifacts/com.symphony.platformsolutions/symphony-opennlp-java/
implementation ("com.symphony.platformsolutions:symphony-opennlp-java:1.0.2")
'com.symphony.platformsolutions:symphony-opennlp-java:jar:1.0.2'
<dependency org="com.symphony.platformsolutions" name="symphony-opennlp-java" rev="1.0.2">
  <artifact name="symphony-opennlp-java" type="jar" />
</dependency>
@Grapes(
@Grab(group='com.symphony.platformsolutions', module='symphony-opennlp-java', version='1.0.2')
)
libraryDependencies += "com.symphony.platformsolutions" % "symphony-opennlp-java" % "1.0.2"
[com.symphony.platformsolutions/symphony-opennlp-java "1.0.2"]

Зависимости

compile (3)

Идентификатор библиотеки Тип Версия
com.fasterxml.jackson.core : jackson-databind jar 2.9.9.2
org.slf4j : slf4j-api jar 1.7.25
org.apache.opennlp : opennlp-tools jar 1.9.1

test (1)

Идентификатор библиотеки Тип Версия
junit : junit jar 4.12

Модули Проекта

Данный проект не имеет модулей.

symphony-opennlp-java

Library for integration with openNLP for Symphony bots Given a message and a file with a list of patterns, returns a list of actions and any given parameters found.

Install using maven

    <dependency>
        <groupId>com.symphony.platformsolutions</groupId>
        <artifactId>symphony-opennlp-java</artifactId>
        <version>1.0.0</version>
    </dependency>

Configuration

Create a nlp-config.json file in your project which includes the following properties

{
  "posmodelPath": "full path to OpenNLP POS model",
  "sentenceSplitterModelPath": "full path to OpenNLP Sentence model",
  "patternsFile": "full path to your patterns.json file"
}

Create a patterns.json file. It defines a list of patterns to be mapped into actions. For example:

[
  {"action":"buyShares",
    "posrequirementList":[
      {"options":["buy","purchase"],"parameter":null,"pos":"V"},
      {"options":null,"parameter":"quantity","pos":"CD"},
      {"options":["shares","stock"],"parameter":null,"pos":"NN"},
      {"options":null,"parameter":null,"pos":"IN"},
      {"options":null,"parameter":"product","pos":"NN"}]
  },
  {"action":"buyShares",
    "posrequirementList":[
      {"options":["buy","purchase"],"parameter":null,"pos":"V"},
      {"options":null,"parameter":"product","pos":"NN"},
      {"options":null,"parameter":"quantity","pos":"CD"}]
  },
  {"action":"buyShares",
    "posrequirementList":[
      {"options":["buy","purchase"],"parameter":null,"pos":"V"},
      {"options":null,"parameter":"product","pos":"*"},
      {"options":null,"parameter":"quantity","pos":"CD"}]
  },
  {"action":"buyShares",
    "posrequirementList":[
      {"options":["buy","purchase"],"parameter":null,"pos":"V"},
      {"options":null,"parameter":"quantity","pos":"CD"},
      {"options":null,"parameter":"product","pos":"NN"}]
  },
  {"action": "decision",
  "posrequirementList":[{"pos":"UH","options":["yes","yeah","sure","yep","confirm","y"],"parameter":"decisionBool", "value": "true"}]
  },
  {"action": "decision",
    "posrequirementList":[{"pos":"UH","options":["no","nope","reject","n"],"parameter":"decisionBool", "value": "false"}]
  },
  {"action":"headlines",
    "posrequirementList":[
      {"options":["headlines","news","articles"],"parameter":null,"pos":"NN"},
      {"options":null,"parameter":null,"pos":"*"},
      {"options":null,"parameter":"product","pos":"NN"}]
  },
  {"action":"headlines",
    "posrequirementList":[
      {"options":null,"parameter":"product","pos":"NN"},
      {"options":["headlines","news","articles"],"parameter":null,"pos":"NN"}
      ]
  }
]

For each Pattern object:

  • action is the name of the action to be mapped to, many patterns can match the same action
  • posrequirementList is the list of Parts of speech requiements for the pattern
    • options (optional) defines a specific list of words that the POS needs to match to fit the pattern
    • paramater (optional) defines the name of the pafamater that the value of this POS would fill
    • pos (required) defines the POS to match for, or * for any POS in that position For a list of POS click here

How to use in your bot code:

URL nlpUrl = getClass().getResource("nlp-config.json");
NLPConfig nlpConfig = NLPConfigLoader.loadFromFile(nlpUrl.getPath());
NLPService nlp = new NLPService(nlpConfig);
List<Action> actions = nlp.match(inboundMessage.getMessageText());
com.symphony.platformsolutions

Symphony Platform Solutions

Symphony supported software client, bots, apps, and examples.

Версии библиотеки

Версия
1.0.2
1.0.1
1.0.0