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).

Common Tag

Tag Description Examples
Email 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

Custom Tag

Developers can set by themselves.

Usage

Here are some examples.

Keyword Example

//"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():

Regex Example

//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():

Tag Constructor

The 4 Steps

  1. Set a tag name. (like "Good friends")
  2. Set the keywords or Regex. (https://github.com/zeeshanu/learn-regex)
  3. Create new tag with constructor

Summary

Fields

DataType Name
String TAG_ID
String NAME
String KEYWORD_LIST
String ENTITY_NAME

Public Constructors

Function Description
Tag () No Parameters
Tag ( String name, Set keywords ) Tag Name and Keywords

Public Methods

Return Type Function
boolean matchWord ( String word, String entity )

Friend Methods

Return type Function
void setName(String name)
String getName()
void setKeywordList()
Set getKeywordList()
boolean matchRE()
boolean matchEntity(String entity)
⚠️ **GitHub.com Fallback** ⚠️