Tag - MessageOnTap/MessageOnTap_API GitHub Wiki
To understand a message, entity recognition is one of the most important things developers might care about. In MessageOnTap, for each meaningful word to developers, we give the word a 'tag'.
For example, if your friend asks you in a message: "Hi Mike, can you send me the google doc link". In this case, the word 'Mike' will be attached with a 'PERSON' tag, which means Mike is a person. Another case would be: "Let's meet at Gates Building". The word 'Gates Building' will be attached with a 'PLACE' tag, which means the phrase, Gates Building, is a place.
Here is an example in Google cloud API:
("Mike" is attached with tag 'PERSON', "Gates Building" is attached with tag 'PLACE')
Try the demo in the following link: https://cloud.google.com/natural-language/
We provide common tags for developers which contain types such as person and place. However, because the developer may care about other keywords in the sentence, we provide the interface to let developers use keyword and regular expression to create customized tags. Common tags and Customized tags share the same data structure (only the setting of custom tags are open to developers).
Tag | Description | Examples |
---|---|---|
Email address | [email protected] | |
Phone | Phone number | 412-100-1001 |
Person | Person name | Mike |
Place | Location name | Gates Building |
Event | Event name | Tylor Swift Concert |
Developers can set by themselves.
Here are some examples.
//"Good Friend" Tag
String mTagName = "tagName";
Set<String> keywords = new HashSet();
keywords.add("Mike");
keywords.add("Fanglin");
keywords.add("Mars"); //Author!!!
keywords.add("Adam");
Tag mTag = new Tag():
//Number Tag
String mTagName = "tagName";
Set<String> keywords = new HashSet();
keywords.add("/^-?\d+$/");
Tag mTag = new Tag():
//Email Tag
String mTagName = "tagName";
Set<String> keywords = new HashSet();
keywords.add("/^.+@.+$/");
Tag mTag = new Tag():
- Set a tag name. (like "Good friends")
- Set the keywords or Regex. (https://github.com/zeeshanu/learn-regex)
- Create new tag with constructor
DataType | Name |
---|---|
String | TAG_ID |
String | NAME |
String | KEYWORD_LIST |
String | ENTITY_NAME |
Function | Description |
---|---|
Tag () | No Parameters |
Tag ( String name, Set keywords ) | Tag Name and Keywords |
Return Type | Function |
---|---|
boolean | matchWord ( String word, String entity ) |
Return type | Function |
---|---|
void | setName(String name) |
String | getName() |
void | setKeywordList() |
Set | getKeywordList() |
boolean | matchRE() |
boolean | matchEntity(String entity) |