diff --git a/neon_skill_stock/__init__.py b/neon_skill_stock/__init__.py index 4e8424f..4220a34 100644 --- a/neon_skill_stock/__init__.py +++ b/neon_skill_stock/__init__.py @@ -47,7 +47,11 @@ def __init__(self, **kwargs): "coca cola": "ko", "coca-cola": "ko", "google": "goog", - "exxonmobil": "xom"} + "exxonmobil": "xom", + "ммм": "mmm", + "кока кола": "ko", + "кокакола": "ko", + "гугл": "goog"} @classproperty def runtime_requirements(self): @@ -112,10 +116,12 @@ def handle_stock_price(self, message): def CQS_match_query_phrase(self, phrase: str): company = self._extract_company(phrase) + LOG.info(company) if not company: LOG.debug(f"no company found in {phrase}") return None try: + company = self.translate_co.get(company.lower(), company) match = self._search_company(company) except Exception as e: LOG.exception(e) @@ -175,7 +181,7 @@ def _get_stock_price(symbol: str): def _extract_company(self, utt): rx_file = self.find_resource('company.rx', 'regex') - LOG.debug(f"Resolved: {rx_file}") + LOG.info(f"Resolved: {rx_file}") if rx_file: with open(rx_file) as f: for pat in f.read().splitlines(): diff --git a/neon_skill_stock/locale/uk-ua/dialog/api.error.dialog b/neon_skill_stock/locale/uk-ua/dialog/api.error.dialog new file mode 100644 index 0000000..8d0e7df --- /dev/null +++ b/neon_skill_stock/locale/uk-ua/dialog/api.error.dialog @@ -0,0 +1 @@ +Ціна акцій недоступна через помилку API: {error} diff --git a/neon_skill_stock/locale/uk-ua/dialog/not.found.dialog b/neon_skill_stock/locale/uk-ua/dialog/not.found.dialog new file mode 100644 index 0000000..81cb0cb --- /dev/null +++ b/neon_skill_stock/locale/uk-ua/dialog/not.found.dialog @@ -0,0 +1,2 @@ +Вибачте, я не зміг знайти ціну акцій для {{company}}. +{{company}} не існує або не має ціни акцій. diff --git a/neon_skill_stock/locale/uk-ua/dialog/stock.price.dialog b/neon_skill_stock/locale/uk-ua/dialog/stock.price.dialog new file mode 100644 index 0000000..9579cfa --- /dev/null +++ b/neon_skill_stock/locale/uk-ua/dialog/stock.price.dialog @@ -0,0 +1 @@ +{{company}}, з тікерним символом {{symbol}}, зараз торгується по {{price}} доларів за акцію. Надано {{provider}}. diff --git a/neon_skill_stock/locale/uk-ua/intent/stock_price.intent b/neon_skill_stock/locale/uk-ua/intent/stock_price.intent new file mode 100644 index 0000000..f3fb72d --- /dev/null +++ b/neon_skill_stock/locale/uk-ua/intent/stock_price.intent @@ -0,0 +1,5 @@ +(скажи мені|я хочу знати) (|яка)(ціна|вартість) (акцій|акції|паю|паїв|біржі) (для|компанії) {company} +скажи мені за якою ціною торгується {company} +яка вартість акцій {company} +який курс акцій {company} +я хочу знати (ціну|вартість) (акцій|акції|паю|паїв|біржі) (для|компанії) {company} diff --git a/neon_skill_stock/locale/uk-ua/regex/company.rx b/neon_skill_stock/locale/uk-ua/regex/company.rx new file mode 100644 index 0000000..998888b --- /dev/null +++ b/neon_skill_stock/locale/uk-ua/regex/company.rx @@ -0,0 +1,5 @@ +(акції|акція|акцій) (про|для|від) (?P.*) +(чи|є|це) (?P.*) (торгується|торгівля|акції|акція|в торгівлі|на біржі) +(?P.*) (торгується|акції|акція) +(про) (?P.*) (акції|акція|акцій) +(акції|акція|акцій) (?P.*) diff --git a/requirements/test.txt b/requirements/test.txt index c831751..fcaa28c 100644 --- a/requirements/test.txt +++ b/requirements/test.txt @@ -1 +1 @@ -neon-minerva[padatious]~=0.3,>=0.3.1a1 +neon-minerva[padatious]~=0.3,>=0.3.1a3 diff --git a/skill.json b/skill.json index 859e0e0..6c4571d 100644 --- a/skill.json +++ b/skill.json @@ -1,16 +1,31 @@ { - "title": "Stock", - "url": "https://github.com/NeonGeckoCom/skill-stock", + "title": "neon-skill-stock", + "icon": "https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/money-check-alt.svg", "summary": "This skill provides stock values.", - "short_description": "This skill provides stock values.", "description": "Use this skill to lookup stock prices. Use of this skill requires use of third-party APIs. This skill will use Neon AI servers by default, but you can deploy your own instance of [Diana](https://github.com/NeonGeckoCom/neon-diana-utils).", "examples": [ "What is the share price for Amazon?", "What is the stock price for Microsoft?" ], - "desktopFile": false, - "warning": "", - "systemDeps": false, + "credits": [ + "Neongecko" + ], + "categories": [ + "Information", + "Daily" + ], + "tags": [], + "category": "Information", + "package_name": "neon-skill-stock", + "pip_spec": "neon-skill-stock", + "license": "BSD-3-Clause", + "author": "Neongecko", + "version": "2.0.1a2", + "url": "https://github.com/NeonGeckoCom/skill-stock", + "skill_id": "skill-stock.neongeckocom=neon_skill_stock:StockSkill", + "skillname": "skill-stock", + "authorname": "NeonGeckoCom", + "name": "neon-skill-stock", "requirements": { "python": [ "neon-utils~=1.12", @@ -21,6 +36,9 @@ "system": {}, "skill": [] }, + "desktopFile": false, + "warning": "", + "systemDeps": false, "incompatible_skills": [], "platforms": [ "i386", @@ -30,25 +48,6 @@ "arm" ], "branch": "master", - "license": "BSD-3-Clause", - "icon": "https://raw.githack.com/FortAwesome/Font-Awesome/master/svgs/solid/money-check-alt.svg", - "category": "Information", - "categories": [ - "Information", - "Daily" - ], - "tags": [ - "NeonGecko", - "NeonAI", - "stock", - "finance" - ], - "credits": [ - "Mycroft AI", - "NeonDaniel", - "reginaneon" - ], - "skillname": "skill-stock", - "authorname": "NeonGeckoCom", - "foldername": null + "foldername": null, + "short_description": "This skill provides stock values." } \ No newline at end of file diff --git a/test/test_intents.yaml b/test/test_intents.yaml index b76e33d..838dccc 100644 --- a/test/test_intents.yaml +++ b/test/test_intents.yaml @@ -34,6 +34,14 @@ en-us: # - what is the share price of apple: # - company: apple +uk-ua: + stock_price.intent: + - я хочу знати ціну акцій для microsoft: + - company: microsoft + - скажи мені за якою ціною торгується tesla: + - company: tesla + - яка вартість акцій apple: + - company: apple common query: en-us: - what is amazon trading at @@ -41,6 +49,12 @@ common query: - what is the share price of apple - what is the stock price for microsoft - tell me about nvidia stock + uk-ua: + - я хочу знати ціну акцій для microsoft + - я хочу знати ціну акцій для гугл + - який курс акцій microsoft + - яка вартість акцій гугл + - який курс акцій кока кола unmatched intents: en-us: