Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Add copy buttons to all
 blocks\n(function() {\n function addCopyButtons() {\n document.querySelectorAll('pre code').forEach(function(codeBlock) {\n if (codeBlock.parentElement.hasAttribute('data-copy-added')) return;\n codeBlock.parentElement.setAttribute('data-copy-added', 'true');\n \n var btn = document.createElement('button');\n btn.textContent = 'Copy';\n btn.style.cssText = 'position:absolute;top:4px;right:4px;padding:2px 8px;font-size:11px;background:#4ecdc4;border:none;border-radius:4px;color:#1a1a2e;cursor:pointer;opacity:0.7;transition:opacity 0.2s;';\n btn.onmouseover = function() { this.style.opacity = '1'; };\n btn.onmouseout = function() { this.style.opacity = '0.7'; };\n btn.onclick = function() {\n navigator.clipboard.writeText(codeBlock.textContent).then(function() {\n btn.textContent = 'Copied!';\n setTimeout(function() { btn.textContent = 'Copy'; }, 1500);\n });\n };\n codeBlock.parentElement.style.position = 'relative';\n codeBlock.parentElement.appendChild(btn);\n });\n }\n \n addCopyButtons();\n \n // Re-run on dynamic content\n var observer = new MutationObserver(addCopyButtons);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Add Copy Buttons to Code Blocks");
}
} catch(__e) { console.warn('[Userscript:Add Copy Buttons to Code Blocks]', __e); }
})();
(function(){
try {
var __m = "github.com";
var __re = new RegExp('^' + "github\\.com" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Force GitHub README to respect dark mode\n(function() {\n var style = document.createElement('style');\n style.textContent = '\n .markdown-body {\n color-scheme: dark light;\n }\n .markdown-body pre { background: #161b22 !important; }\n .markdown-body code { background: rgba(110, 118, 129, 0.4) !important; }\n .markdown-body table th, .markdown-body table td { border-color: #30363d !important; }\n .markdown-body img { background: #0d1117; }\n .markdown-body blockquote { border-left-color: #8b949e; }\n .markdown-body hr { border-color: #30363d; }\n ';\n document.head.appendChild(style);\n})();", "GitHub Dark Mode README Fix"); } } catch(__e) { console.warn('[Userscript:GitHub Dark Mode README Fix]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Highlight search terms from Google/DuckDuckGo/Bing referrer\n(function() {\n var ref = document.referrer;\n var terms = [];\n \n if (ref.includes('google.com') || ref.includes('duckduckgo.com') || ref.includes('bing.com')) {\n var url = new URL(ref);\n var q = url.searchParams.get('q') || url.searchParams.get('p');\n if (q) {\n terms = q.split(/\\s+/).filter(function(t) { return t.length > 2; });\n }\n }\n \n if (terms.length === 0) return;\n \n var style = document.createElement('style');\n style.textContent = '.userscript-highlight { background: #fbbf24; color: #1a1a2e; padding: 1px 3px; border-radius: 2px; }';\n document.head.appendChild(style);\n \n function highlight(node) {\n if (node.nodeType === 3) { // text node\n var text = node.textContent;\n var found = false;\n terms.forEach(function(term) {\n var regex = new RegExp('(' + term.replace(/[.*+?^${}()|[\\]\\\\]/g, '\\\\') + ')', 'gi');\n if (regex.test(text)) {\n found = true;\n var frag = document.createDocumentFragment();\n var parts = text.split(regex);\n parts.forEach(function(part, i) {\n if (i % 2 === 0) {\n frag.appendChild(document.createTextNode(part));\n } else {\n var span = document.createElement('span');\n span.className = 'userscript-highlight';\n span.textContent = part;\n frag.appendChild(span);\n }\n });\n node.parentNode.replaceChild(frag, node);\n }\n });\n } else if (node.nodeType === 1 && node.childNodes) { // element\n var skipTags = ['SCRIPT', 'STYLE', 'NOSCRIPT', 'TEXTAREA', 'INPUT', 'SELECT'];\n if (!skipTags.includes(node.tagName)) {\n Array.from(node.childNodes).forEach(highlight);\n }\n }\n }\n \n highlight(document.body);\n \n // Re-highlight on dynamic content\n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1 || node.nodeType === 3) highlight(node);\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Highlight Search Terms"); } } catch(__e) { console.warn('[Userscript:Highlight Search Terms]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Strip utm_, fbclid, gclid, etc. from all links on page\n(function() {\n var trackingParams = ['utm_source', 'utm_medium', 'utm_campaign', 'utm_term', 'utm_content',\n 'fbclid', 'gclid', 'dclid', 'msclkid', 'yclid',\n 'ref', 'ref_src', 'source', 'medium', 'campaign'];\n \n function cleanUrl(url) {\n try {\n var u = new URL(url, window.location.origin);\n var changed = false;\n trackingParams.forEach(function(p) {\n if (u.searchParams.has(p)) {\n u.searchParams.delete(p);\n changed = true;\n }\n });\n return changed ? u.toString() : url;\n } catch (e) {\n return url;\n }\n }\n \n function cleanLinks() {\n document.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n \n cleanLinks();\n \n var observer = new MutationObserver(function(mutations) {\n mutations.forEach(function(m) {\n m.addedNodes.forEach(function(node) {\n if (node.nodeType === 1) {\n if (node.tagName === 'A') cleanLinks();\n node.querySelectorAll('a[href]').forEach(function(a) {\n var clean = cleanUrl(a.href);\n if (clean !== a.href) a.href = clean;\n });\n }\n });\n });\n });\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "Remove Tracking Parameters from Links"); } } catch(__e) { console.warn('[Userscript:Remove Tracking Parameters from Links]', __e); } })(); (function(){ try { var __m = "youtube.com"; var __re = new RegExp('^' + "youtube\\.com" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Auto-enable theater mode on YouTube\n(function() {\n function tryTheater() {\n var btn = document.querySelector('button[aria-label=\"Theater mode\"], ytd-player #player button[title=\"Theater mode\"]');\n if (btn && !btn.classList.contains('activated')) {\n btn.click();\n }\n }\n \n // Try immediately\n tryTheater();\n \n // Try after navigation (SPA)\n var lastUrl = location.href;\n setInterval(function() {\n if (location.href !== lastUrl) {\n lastUrl = location.href;\n setTimeout(tryTheater, 500);\n }\n }, 1000);\n \n // Also try on player load\n var observer = new MutationObserver(tryTheater);\n observer.observe(document.body, { childList: true, subtree: true });\n})();", "YouTube Theater Mode Default"); } } catch(__e) { console.warn('[Userscript:YouTube Theater Mode Default]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Remove or un-stick sticky/fixed headers that block content\n(function() {\n function unstick() {\n document.querySelectorAll('header, nav, [role=\"banner\"], .header, .navbar, .sticky, .fixed-top, [style*=\"position: fixed\"], [style*=\"position:sticky\"]').forEach(function(el) {\n if (el.style.position === 'fixed' || el.style.position === 'sticky' || \n getComputedStyle(el).position === 'fixed' || getComputedStyle(el).position === 'sticky') {\n el.style.position = 'static';\n el.style.top = 'auto';\n el.style.zIndex = 'auto';\n }\n });\n }\n \n unstick();\n \n var observer = new MutationObserver(unstick);\n observer.observe(document.body, { childList: true, subtree: true, attributes: true, attributeFilter: ['style', 'class'] });\n})();", "Kill Sticky Headers"); } } catch(__e) { console.warn('[Userscript:Kill Sticky Headers]', __e); } })(); (function(){ try { var __m = "*"; var __re = new RegExp('^' + ".*" + '
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages

, 'i'); if (__m === '*' || __re.test(location.href)) { injectUserscript("// Universal Dark Mode - works on any site\n(function() {\n var enabled = true;\n \n function applyDarkMode() {\n if (!enabled) return;\n \n // Create style element if it doesn't exist\n var style = document.getElementById('universal-dark-mode-style');\n if (!style) {\n style = document.createElement('style');\n style.id = 'universal-dark-mode-style';\n document.head.appendChild(style);\n }\n \n // Dark mode CSS - inverts colors but preserves images/video\n style.textContent = '\n /* Invert everything except media */\n html {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #1a1a2e !important;\n }\n \n /* Restore images, videos, iframes, canvas */\n img, video, iframe, canvas, svg, picture, [style*=\"background-image\"] {\n filter: invert(1) hue-rotate(180deg) !important;\n }\n \n /* Preserve specific elements that should not be inverted */\n .no-dark-mode, .no-dark-mode *,\n [data-theme=\"light\"], [data-theme=\"light\"],\n .ace_editor, .ace_editor *,\n .CodeMirror, .CodeMirror *,\n .monaco-editor, .monaco-editor *,\n .markdown-body pre, .markdown-body pre *,\n .highlight, .highlight *,\n pre code, pre code * {\n filter: none !important;\n }\n \n /* Fix common UI elements */\n .modal, .popup, .dropdown-menu, .tooltip, .popover {\n filter: invert(1) hue-rotate(180deg) !important;\n background: #2d2d44 !important;\n border-color: #444 !important;\n }\n \n /* Scrollbars */\n ::-webkit-scrollbar { background: #1a1a2e !important; }\n ::-webkit-scrollbar-thumb { background: #444 !important; }\n ::-webkit-scrollbar-thumb:hover { background: #555 !important; }\n \n /* Selection */\n ::selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ::-moz-selection { background: #4ecdc4 !important; color: #1a1a2e !important; }\n ';\n }\n \n function removeDarkMode() {\n var style = document.getElementById('universal-dark-mode-style');\n if (style) style.remove();\n }\n \n // Toggle with Alt+Shift+D\n document.addEventListener('keydown', function(e) {\n if (e.altKey && e.shiftKey && e.key === 'D') {\n e.preventDefault();\n enabled = !enabled;\n if (enabled) {\n applyDarkMode();\n console.log('[Universal Dark Mode] Enabled');\n } else {\n removeDarkMode();\n console.log('[Universal Dark Mode] Disabled');\n }\n }\n });\n \n // Apply on load\n applyDarkMode();\n \n // Re-apply on dynamic content\n var observer = new MutationObserver(function(mutations) {\n if (enabled && !document.getElementById('universal-dark-mode-style')) {\n applyDarkMode();\n }\n });\n observer.observe(document.head, { childList: true });\n \n console.log('[Universal Dark Mode] Loaded - Press Alt+Shift+D to toggle');\n})();", "Universal Dark Mode"); } } catch(__e) { console.warn('[Userscript:Universal Dark Mode]', __e); } })(); })();
Skip to content

Repository files navigation

Mauna SDK

Installation and usage

Build

poetry install

poetry run codegen

poetry build

Install

pip install mauna_sdk

API list

api.chitchat

Takes an input and a list of history messages, determines if chitchat is started and generates the corresponding response

frommauna_sdkimportMaunafrommauna_sdk.api.chitchatimportchitchatfrommauna_sdk.api.input.turnimportTurn, Agentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=chitchat.execute(
client, input="This is the good weather today", history=[
Turn(agent=Agent.USER, said="Hello"),
Turn(agent=Agent.BOT, said="Hi there")
]
)
# result == chitchat.chitchatData.ChitchatResponse(response='{\'response\': "It\'s been raining for a few days now."}')

api.commonsenseReasoning

Pulls various relations out of the given text

frommauna_sdkimportMaunafrommauna_sdk.api.commonsense_reasoningimportcommonsenseReasoningdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=commonsenseReasoning.execute(client, text="Hello")
# result == [# commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xAttr', # result=[# 'determined', # 'curious', # 'brave', # 'confident', # 'capable', # 'smart', # 'dedicated', # 'thoughtful', # 'careless', # 'mean'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xEffect', # result=[# 'gets yelled at', # 'personx sweats from nervousness', # 'gets called a liar', # 'personx is arrested', # 'gets arrested', # 'gets tired', # 'is praised', # 'personx sweats', # 'none', # 'personx is arrested for assault'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xIntent', # result=[# 'to have fun', # 'to get something done', # 'to satisfy his hunger', # 'to show off skills', # 'to satisfy his cravings', # 'to do something', # 'to have a good time', # 'to show off', # 'none', # 'to be a part of something'# ]# ), # commonsenseReasoning.commonsenseReasoningData.RelationResult(# type='xWant', # result=[# 'to take a break', # 'to be successful', # 'to do something else', # 'to go home', # 'to have fun', # 'to have a good time', # 'to show off', # 'to rest', # 'to show off their skills', # 'to show off their new purchase'# ]# )# ]

api.conceptnetGrounding

Takes a text and returns related texts, according to relation type(s).

frommauna_sdkimportMaunafrommauna_sdk.api.conceptnet_groundingimportconceptnetGroundingfrommauna_sdk.api.enum.relationsimportRelationsdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=conceptnetGrounding.execute(client, text="max with axe", relations=[Relations.CapableOf])
# result == [# conceptnetGrounding.conceptnetGroundingData.RelationResult(# type='CapableOf', # result=[# 'chop down tree', # 'split wood', # 'chop wood', # 'cut wood', # 'break window', # 'chop firewood', # 'cut firewood', # 'cut lumber', # 'cut tree', # 'cut you in half'# ]# )# ]

api.parseACE

Takes an ACE text and an output format and produces the parsed ACE according to the format

frommauna_sdkimportMaunafrommauna_sdk.api.parse_aceimportparseACEfrommauna_sdk.api.enum.a_c_e_output_typeimportACEOutputTypedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseACE.execute(client, text="John walks.", format=ACEOutputType.drs)
# result == parseACE.parseACEData.ACEResult(parsed="drs([A],[predicate(A,walk,named('John'))-1/2])\n")

api.parseContext

Takes a list of turns ({ content: string }) and parses them to produce a semantic frames-based context object.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_contextimportparseContextfrommauna_sdk.api.input.context_objectimportContextObjectdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseContext.execute(client, turns=[ContextObject(content="Today is a good day")])
# result == [# parseContext.parseContextData.ContextResult(# context=parseContext.parseContextData.ContextResult.SlingDocument(# mentions=[# parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :DATE}'], # phrase='Today'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :/pb/predicate /pb/ARG1: {=#2 :DATE} /pb/ARG2: {=#3 :thing}}'], phrase='is'# ), # parseContext.parseContextData.ContextResult.SlingDocument.SlingMention(# evokes=['{=#1 :thing}'], phrase='day'# )# ]# )# )# ]

api.paraphraseSentence

Takes an english sentence and produces paraphrased versions of it that retain the semantic meaning of the original.

frommauna_sdkimportMaunafrommauna_sdk.api.paraphrase_sentenceimportparaphraseSentencedeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=paraphraseSentence.execute(client, sentence="I like tomatoes", count=2)
# result == paraphraseSentence.paraphraseSentenceData.Paraphrase(# paraphrases=[# 'I like tomatoes.', # 'I enjoy tomatoes.', # 'I like to eat tomatoes.', # 'I am a fan of tomatoes.', # 'I enjoy eating tomatoes.', # 'I like eating tomatoes.', # 'I love tomatoes.', # 'I like the taste of tomatoes.', # 'I like fresh tomatoes.', # 'I like to eat fruit.'# ]# )

api.predictNextTurn

Takes a list of utterances as history and a list of possible alternatives that can be replied with. Returns the most likely alternative and confidence in that prediction.

frommauna_sdkimportMaunafrommauna_sdk.api.predict_next_turnimportpredictNextTurndeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=predictNextTurn.execute(client, history=["Hello", "How are you?"], alternatives=["I am fine", "Hello"])
# result == [# predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='I am fine', # confidence=0.6935682892799377# ), # predictNextTurn.predictNextTurnData.DialogAlternative(# nextTurn='Hello', # confidence=0.5061840415000916# )# ]

api.matchIntent

Takes a list of intents (with slots) and a user input. Performs structured information extraction to find the correct intent and fill the corresponding slots.

frommauna_sdkimportMaunafrommauna_sdk.api.match_intentimportmatchIntentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=matchIntent.execute(
client,
input="I require insurance",
intent=[
"Someone requires insurance", "An ENTITYPERSON takes out insurance"
]
)
# result == matchIntent.matchIntentData.MatchIntentOutput(# matches=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch(# intent='Someone requires insurance', # confidence=1.0, # slots=[# matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='require', # value='require', # match_type='direct', # confidence=1.0# ), # matchIntent.matchIntentData.MatchIntentOutput.PhraseMatch.WordMatch(# slot='insurance', # value='insurance', # match_type='direct', # confidence=1.0)# ]# )# ]# )

api.measureSimilarity

Takes a target sentence and a list of other sentences to compare with for similarity. Returns an array of pairwise similarity scores.

frommauna_sdkimportMaunafrommauna_sdk.api.measure_similarityimportmeasureSimilaritydeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=measureSimilarity.execute(
client, sentence="Today is a good day", compareWith=["Today is an awesome day", "Today is a bad day"]
)
# result == measureSimilarity.measureSimilarityData.SentenceSimilarityScores(# result=[# measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.6445285081863403, # sentencePair=['Today is a good day', 'Today is an awesome day']# ), # measureSimilarity.measureSimilarityData.SentenceSimilarityScores.PairSimilarity(# score=0.3357277512550354, # sentencePair=['Today is a good day', 'Today is a bad day']# )# ]# )

api.resolveCoreferences

frommauna_sdkimportMaunafrommauna_sdk.api.resolve_coreferencesimportresolveCoreferencesdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=resolveCoreferences.execute(client, text="Emma said that she thinks that Nelson really likes to dance.")
# result == resolveCoreferences.resolveCoreferencesData.NlpDoc(# coref=resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension(# detected=True, # resolvedOutput='Emma said that Emma thinks that Nelson really likes to dance.', # clusters=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Emma', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=0.9530903100967407# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=0.2935597896575928# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=8.278848648071289# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='she thinks that Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=1.7855921983718872# ),# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.801807165145874# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-1.6977876424789429# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=0.4910166263580322# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-2.120563507080078# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.0476505756378174# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.5593587160110474# )# ]# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores(# mention='Nelson really likes to dance', # references=[# resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson really likes to dance', # score=1.6450811624526978# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Emma', # score=-1.7996364831924438# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she', # score=-2.02427339553833# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='she thinks that Nelson really likes to dance', # score=-1.497442603111267# ), # resolveCoreferences.resolveCoreferencesData.NlpDoc.DocExtension.CorefScores.Scores(# match='Nelson', # score=-1.5290888547897339# )# ]# )# ]# )# )

api.toVec

Takes an English text as an input and returns vector representation for passage, its sentences and entities if found.

frommauna_sdkimportMaunafrommauna_sdk.api.to_vecimporttoVecdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=toVec.execute(client, text="John likes to play piano")
# result == toVec.toVecData.NlpDoc(# has_vector=True, # vector=[# 0.08898600190877914, # ...# ], # vector_norm=3.998985419599661, # sentences=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=3.9989852905273438, # vector=[# 0.08898600190877914, # ...# ], # text='John likes to play piano'# )# ], # entities=[# toVec.toVecData.NlpDoc.Span(# has_vector=True, # vector_norm=6.533577919006348, # vector=[# -0.29218998551368713, # ...# ], # text='John'# )# ]# )

api.getSentiment

Takes plain English input and returns overall and sentence-level sentiment information. Represents positivity or negativity of the passage as a floating point value.

frommauna_sdkimportMaunafrommauna_sdk.api.get_sentimentimportgetSentimentdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=getSentiment.execute(client, text="The movie is awesome")
# result == getSentiment.getSentimentData.NlpDoc(# sentiment=0.9467527270317078, # sentences=[# getSentiment.getSentimentData.NlpDoc.Span(# text='The movie is awesome', # sentiment=0.0# )# ]# )

api.parseText

Takes some plain English input and returns parsed categories, entities and sentences.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_textimportparseTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseText.execute(client, text="Today is a good day")
# result == parseText.parseTextData.NlpDoc(# categories=[], # entities=[# parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='today', # text='Today'# ), # parseText.parseTextData.NlpDoc.Span(# label='DATE', # lemma='a good day', # text='a good day'# )# ], # sentences=[# parseText.parseTextData.NlpDoc.Span(# label='', # lemma='today be a good day', # text='Today is a good day'# )# ]# )

api.extractNumericData

Takes some text and extracts numeric references as a list of tokens with numeric annotations.

frommauna_sdkimportMaunafrommauna_sdk.api.extract_numeric_dataimportextractNumericDatadeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=extractNumericData.execute(client, text="I told you two")
# result == extractNumericData.extractNumericDataData.NlpDoc(# tokens=[# extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data=None, # has_numeric=False# )# ), # extractNumericData.extractNumericDataData.NlpDoc.Token(# numeric_analysis=extractNumericData.extractNumericDataData.NlpDoc.Token.TokenExtension(# data='PEOPLE', # has_numeric=True# )# )# ]# )

api.parseTextTokens

Takes some plain English string as input and returns a list of its tokens annotated with linguistic information.

frommauna_sdkimportMaunafrommauna_sdk.api.parse_text_tokensimportparseTextTokensdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=parseTextTokens.execute(client, text="Hello there")
# result == parseTextTokens.parseTextTokensData.NlpDoc(# tokens=[# parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='ROOT', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, is_oov=False, # is_sent_start=True, # is_stop=False, # is_title=True, # lemma='hello', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='INTJ', # prob=-10.583807945251465, # tag='UH', # text='Hello'# ), # parseTextTokens.parseTextTokensData.NlpDoc.Token(# dependency='advmod', # entity_type='', # is_alpha=True, # is_currency=False, # is_digit=False, # is_oov=False, # is_sent_start=None, # is_stop=True, # is_title=False, # lemma='there', # like_email=False, # like_num=False, # like_url=False, # part_of_speech='ADV', # prob=-6.135282039642334, # tag='RB', # text='there'# )# ]# )

api.renderCSS

Takes ssml and corresponding styles as a css string. Returns base64 encoded audio.

frommauna_sdkimportMaunafrommauna_sdk.api.render_cssimportrenderCSSdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=renderCSS.execute(client, ssml="<s class='test'>Hello</s>", css=".test {volume: 120%;}")
# result == renderCSS.renderCSSData.ComposeResult(# result={'$result': {'callTextToSpeech': {'audioB64': 'UklGRoDyAgBXQVZFZm ... '}}, '$context': {}}# )

api.speechToText

Takes base64 encoded audio as input and returns a list of possible transcripts (sorted in order of decreasing confidence).

frommauna_sdkimportMaunafrommauna_sdk.api.speech_to_textimportspeechToTextdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=speechToText.execute(client, audio="AAAA ...")
# result == speechToText.speechToTextData.STTResult(# transcript=[# speechToText.speechToTextData.STTResult.TextAlternative(text="Hello.")# ]# )

api.textToSpeech

Takes text (string) as input and returns audio encoded as a base64 string.

frommauna_sdkimportMaunafrommauna_sdk.api.text_to_speechimporttextToSpeechdeveloper_id=<int># Check your profile on the dashboard for this.api_key="<64 letter api key available on your mauna dashboard>"client=Mauna(api_key, developer_id)
result=textToSpeech.execute(client, text="Hello")
# result == textToSpeech.textToSpeechData.TTSResult(audio='UklGRpJb ...')

About

Mauna Python SDK

Resources

Stars

0 stars

Watchers

2 watching

Forks

Releases

Packages

Contributors

Languages