Go nocodeapi.net SDK
Installation
go get -u bitbucket.org/zeusakm/go_sdk
Key phrases
godotenv.Load()
client = NewClient(config.NewConfig(os.Getenv("DEV_JWT_TOKEN")))
res, err := client.GetKeyPhrases("Now, as a nation, we don't promise equal outcomes, but we were founded on the idea everybody should have an equal opportunity to succeed. No matter who you are, what you look like, where you come from, you can make it. That's an essential promise.", "en_US")
res.LanguageCode // en_US
res.KeyPhrases // slice of []KeyPhrase
/**
[]entity.KeyPhrase{
{
"Text": "promise equal outcomes",
"Score": 8,
"BeginOffset": 27,
"EndOffset": 49
},
{
"Text": "equal opportunity",
"Score": 4.5,
"BeginOffset": 108,
"EndOffset": 125
},
{
"Text": "essential promise",
"Score": 4.5,
"BeginOffset": 229,
"EndOffset": 246
},
{
"Text": "nation",
"Score": 1,
"BeginOffset": 10,
"EndOffset": 16
},
{
"Text": "founded",
"Score": 1,
"BeginOffset": 63,
"EndOffset": 70
},
{
"Text": "idea",
"Score": 1,
"BeginOffset": 78,
"EndOffset": 82
},
{
"Text": "succeed",
"Score": 1,
"BeginOffset": 129,
"EndOffset": 136
},
{
"Text": "matter",
"Score": 1,
"BeginOffset": 141,
"EndOffset": 147
},
{
"Text": "make",
"Score": 1,
"BeginOffset": 210,
"EndOffset": 214
},
{
"Text": "america",
"Score": 1,
"BeginOffset": false,
"EndOffset": 7
},
{
"Text": "start",
"Score": 1,
"BeginOffset": 269,
"EndOffset": 274
},
{
"Text": "determine",
"Score": 1,
"BeginOffset": 286,
"EndOffset": 295
},
{
"Text": "end",
"Score": 1,
"BeginOffset": 306,
"EndOffset": 309
},
{
"Text": "read",
"Score": 1,
"BeginOffset": false,
"EndOffset": 4
}
}
**/
Language Detection
res, err := client.GetLanguageDetection("Policjanci otrzymali zgłoszenie w tej sprawie po godz 9. Do wypadku doszło na ul. Kolonia Krakowskie Przedmieście.")
res.LanguageCode // pl
res.Language // Polish
res.Score // float64(1)
Sentiment Analysis
res, err := client.GetEmotions("Genuine leather is the best production for bags imho, but I would not recommend this particular product.")
res.Positive // 0.12
res.Negative // 0.14
res.Neutral // 9.74
res.Mixed // 9.97
Custom Classification
// creating classification
res, err := client.CreateClassification("anxious_customer", "I was horrified to see that little to no social distancing practices were being followed. American claims that they enforce a policy where customers are required to wear masks throughout their flight. The woman next to me was not wearing a mask throughout the duration of the flight. She was not eating or drinking, and was otherwise capable of wearing one. The flight attendant walked by multiple times and even had a conversation with the woman, but from what I could hear never told her to wear her mask. There were several other people in the rows around me not wearing masks either. I found this ironic because American kept announcing that they had a mask policy before we got on the flight. There were many people who were also wearing masks around their chins or in other improper fashions. My flight was also very close to full capacity. I know that other airlines are at least skipping seats between customers to try and stick to CDC recommendations, but almost everyone was shoulder to shoulder with someone else. I felt very unsafe and anxious during the whole flight, especially because I was in such close proximity to those people not wearing masks. I will not be flying American again.")
fmt.Println(res) // true
// getting classification
resClassification, err := client.GetClassification("My flight was also very close to full capacity. I know that other airlines are at least skipping seats between customers to try and stick to CDC recommendations, but almost everyone was shoulder to shoulder with someone else. I felt very unsafe and anxious during the whole flight, especially because I was in such close proximity to those people not wearing masks. I will not be flying American again.")
fmt.Println(resClassification.Label) // anxious_customer
// update
res, err = client.UpdateClassification("anxious_customer3", "I was horrified to see that little to no social distancing practices were being followed. American claims that they enforce a policy where customers are required to wear masks throughout their flight. The woman next to me was not wearing a mask throughout the duration of the flight. She was not eating or drinking, and was otherwise capable of wearing one. The flight attendant walked by multiple times and even had a conversation with the woman, but from what I could hear never told her to wear her mask. There were several other people in the rows around me not wearing masks either. I found this ironic because American kept announcing that they had a mask policy before we got on the flight. There were many people who were also wearing masks around their chins or in other improper fashions. My flight was also very close to full capacity. I know that other airlines are at least skipping seats between customers to try and stick to CDC recommendations, but almost everyone was shoulder to shoulder with someone else. I felt very unsafe and anxious during the whole flight, especially because I was in such close proximity to those people not wearing masks. I will not be flying American again. Foo Bar Baz")
fmt.Println(res) // true
// delete
res, err = client.DeleteClassification("anxious_customer") // true/false
Named Entity Recognition
res, err := client.GetNamedEntities("Linus Torvalds is one of the best programmers in USA, Finland Helsinki and in the world")
fmt.Println(res.EntitiesCount) // int64(3)
fmt.Println(res.Entities)
/**
[]entity.Entity{{
Text: "Linus Torvalds",
Label: "PERSON",
},
{
Text: "USA",
Label: "GPE",
},
{
Text: "Finland Helsinki",
Label: "GPE",
}}
**/