Skip to content

Commit

Permalink
Merge pull request #817 from stanford-oval/wip/mehrad/po-tests
Browse files Browse the repository at this point in the history
PO tests
  • Loading branch information
Mehrad0711 committed Oct 20, 2021
2 parents 774d6be + bcb68f4 commit 4c1f15a
Show file tree
Hide file tree
Showing 8 changed files with 628 additions and 18 deletions.
9 changes: 9 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,15 @@ jobs:
- travis_retry npm ci
script: npx nyc ./test/cmdline.sh
after_success: npm run coverage
-
name: "Translation Tests"
install:
- pyenv global 3.7.1
- ./travis/install-starter-deps.sh
- pip3 install polib
- travis_retry npm ci
script: npx nyc ./test/translate.sh
after_success: npm run coverage
-
name: "Starter Code Tests (Basic)"
install:
Expand Down
5 changes: 4 additions & 1 deletion po/main.mk
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
SHELL := /bin/bash

po_file ?=
geniedir = .
genie ?= node --experimental_worker --max_old_space_size=8400 $(geniedir)/dist/tool/genie.js

builtin_skills = $(foreach d,$(wildcard $(geniedir)/data/builtins/*/manifest.tt),$(patsubst %/manifest.tt,$$(basename %),$(d)))
builtin_path = $(geniedir)/data/builtins/

create-pot: $(geniedir)/po
make all
Expand All @@ -15,7 +18,7 @@ create-pot: $(geniedir)/po
for skill in $(builtin_skills) ; do \
kind=$$skill-$$fname ; \
echo "processing $$kind" ; \
$(genie) extract-translatable-annotations $(geniedir)/data/builtins/$$skill/"$$fname".tt -o $</tmp/$$kind.js ; \
$(genie) extract-translatable-annotations $(builtin_path)/$$skill/"$$fname".tt -o $</tmp/$$kind.js ; \
echo $</tmp/$$kind.js >> po/POTFILES ; \
done ; \
done
Expand Down
6 changes: 5 additions & 1 deletion po/translate.mk
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
SHELL := /bin/bash

GENIENLP_EMBEDDINGS ?= ../genienlp/.embeddings

geniedir ?= .
Expand All @@ -6,6 +8,8 @@ genienlp ?= GENIENLP_EMBEDDINGS=$(GENIENLP_EMBEDDINGS) ; genienlp
skip_po_creation = true
skip_translation = false

non_interactive =

model_name_or_path=Helsinki-NLP/opus-mt-$(src_lang)-$(tgt_lang)
# model_name_or_path=facebook/mbart-large-50-one-to-many-mmt
# model_name_or_path=facebook/mbart-large-50-many-to-many-mmt
Expand All @@ -23,7 +27,7 @@ $(geniedir)/po/$(tgt_lang): $(geniedir)/po

# prepare po
if ! $(skip_po_creation) ; then \
cd $< ; rm -rf $(tgt_lang).po ; msginit -i genie-toolkit.pot -l $(tgt_lang) ; \
cd $< ; rm -rf $(tgt_lang).po ; msginit -i genie-toolkit.pot -l $(tgt_lang) $(if $(non_interactive),--no-translator,) ; \
fi
mkdir -p $@
cp $</$(tgt_lang).po $@/input.po
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,164 @@
dataset @org.thingpedia.builtin.thingengine.builtin
#[language="en"] {
stream = monitor(@org.thingpedia.builtin.thingengine.builtin.get_gps())
#_[utterances=["wenn mein Standort sich ändert", "wenn ich mich bewege", "wenn ich mich bewege", "wenn ich den Standort ändere", "wenn meine Position sich ändert"]]
#[id=53269105]
#[name="MonitorGetCurrentLocation"];

stream (p_location : Location) = monitor(@org.thingpedia.builtin.thingengine.builtin.get_gps()) filter location == p_location
#_[utterances=["wenn mein Standort sich ändert $p_location", "wenn ich erreiche $p_location", "wenn ich zu $p_location", "wenn ich ankomme $p_location"]]
#[id=53269110]
#[name="MonitorGetCurrentLocationByLocation"];

stream (p_location : Location) = monitor(@org.thingpedia.builtin.thingengine.builtin.get_gps()) filter !(location == p_location)
#_[utterances=["wenn ich weg von $p_location", "wenn mein Standort sich von $p_location", "wenn ich gehe $p_location"]]
#[id=53269117]
#[name="MonitorGetCurrentLocationNotByLocation"];

program = @org.thingpedia.builtin.thingengine.builtin.get_time()
#_[utterances=["Wie spät ist es"]]
#[id=53269120]
#[name="GetTime"];

program = @org.thingpedia.builtin.thingengine.builtin.get_date()
#_[utterances=["was heute ist", "welcher Tag ist es"]]
#[id=53269122]
#[name="GetDate"];

query = @org.thingpedia.builtin.thingengine.builtin.get_random_between()
#_[utterances=[", wählen Sie eine zufällige Zahl", ", werfen Sie einen Würfel"]]
#[id=53269126]
#[name="GetRandomInteger"];

query (p_low : Number, p_high : Number) = @org.thingpedia.builtin.thingengine.builtin.get_random_between(high=p_high, low=p_low)
#_[utterances=["eine zufällige Zahl zwischen ${p_low:const} und und ${p_high:const}", "eine zufällige Ganzzahl zwischen ${p_low:const} und und ${p_high:const}", ", werfen Sie einen Würfel zwischen ${p_low:const} und und ${p_high:const}", ", erzeugen Sie eine zufällige Zahl zwischen ${p_low:const} und und ${p_high:const}", ", wählen Sie eine Zahl zwischen ${p_low:const} und und ${p_high:const}"]]
#[id=53269129]
#[name="GetRandomIntegerWithLowWithHigh"];

query (p_device : Entity(tt:device)) = @org.thingpedia.builtin.thingengine.builtin.device_info(id=p_device)
#_[utterances=["Informationen über ${p_device}", "Hilfe bei ${p_device}", "${p_device} Hilfe!", "${p_device} Dokumentationen"]]
#[name="DeviceInfoWithDevice"];

action (p_message : String) = @org.thingpedia.builtin.thingengine.builtin.say(message=p_message)
#_[utterances=["Schick mir eine Nachricht ${p_message:const}", "Sag mir, $p_message", "sagen: $p_message"]]
#[id=53269140]
#[name="SayWithMessage"];

action (p_url : Entity(tt:url)) = @org.thingpedia.builtin.thingengine.builtin.open_url(url=p_url)
#_[utterances=["geöffnet. $p_url", "Datei öffnen unter $p_url", "geöffnet. $p_url in the browser", "zu durchsuchen $p_url"]]
#[id=53269149]
#[name="OpenUrlOnBuiltinWithUrl"];

action (p_device : Entity(tt:device)) = @org.thingpedia.builtin.thingengine.builtin.configure(device=p_device)
#_[utterances=["konfigurieren. $p_device", "Einrichtung: $p_device", "aktivieren. $p_device", "installieren. $p_device", "Verbindung zu $p_device", "Neue hinzufügen $p_device account"]]
#[id=53269136]
#[name="ConfigureWithDevice"];

action (p_status : Enum(on, off)) = @org.thingpedia.builtin.thingengine.builtin.set_voice_output(status=p_status)
#_[utterances=["drehen. ${p_status:no-undefined} Sprachausgabe"]];

program (p_status : Enum(on, off)) = @org.thingpedia.builtin.thingengine.builtin.set_voice_output(status=p_status)
#_[utterances=["drehen. ${p_status:no-undefined} deine Stimme"]];

program = @org.thingpedia.builtin.thingengine.builtin.set_voice_output(status=enum on)
#_[utterances=["Fangen Sie an zu sprechen", "Sprich mit mir", "mit Stimme zu sprechen", "Sprich mit mir"]];

program = @org.thingpedia.builtin.thingengine.builtin.set_voice_output(status=enum off)
#_[utterances=["Sprachausgabe deaktivieren"]];

action (p_status : Enum(on, off)) = @org.thingpedia.builtin.thingengine.builtin.set_voice_input(status=p_status)
#_[utterances=["drehen. ${p_status} Spracheingabe"]];

program = @org.thingpedia.builtin.thingengine.builtin.set_voice_input(status=enum on)
#_[utterances=["Hör zu", "Ich will meine Stimme benutzen", "Hör mir zu"]];

program = @org.thingpedia.builtin.thingengine.builtin.set_voice_input(status=enum off)
#_[utterances=["Spracheingabe deaktivieren", "Hör nicht auf zu hören"]];

program (p_name : String) = @org.thingpedia.builtin.thingengine.builtin.set_name(name=p_name)
#_[utterances=["Ruf mich an. ${p_name:no-undefined}", "Ich beziehe mich auf mich als ${p_name:no-undefined}", "Ich bin ${p_name:no-undefined}", "Mein Name ist ${p_name:no-undefined}", "Ich möchte, dass du mich anrufst ${p_name:no-undefined}"]];

action (p_type : Enum(current, home, work)) = @org.thingpedia.builtin.thingengine.builtin.set_location(type=p_type)
#_[utterances=["stellen Sie meine ${p_type:no-undefined} Standort:", "stellen Sie meine ${p_type:no-undefined} Anschrift:", "Erinnern Sie sich an meine ${p_type:no-undefined} Standort:", "ändern meine ${p_type:no-undefined} Anschrift:"]];

program (p_location : Location) = @org.thingpedia.builtin.thingengine.builtin.set_location(location=p_location)
#_[utterances=["Meine Adresse ist ${p_location:no-undefined}", "Mein Standort ist ${p_location:no-undefined}"]];

program (p_type : Enum(current, home, work), p_location : Location) = @org.thingpedia.builtin.thingengine.builtin.set_location(location=p_location, type=p_type)
#_[utterances=["meins ${p_type:no-undefined} Adresse ist ${p_location:no-undefined}", "meins ${p_type:no-undefined} ist bei ${p_location:no-undefined}"]];

program (p_unit : Enum(celsius, fahrenheit, kelvin)) = @org.thingpedia.builtin.thingengine.builtin.set_temperature_unit(unit=p_unit)
#_[utterances=["Verwendung: ${p_unit:no-undefined} für Temperaturen", "Verwendung: ${p_unit:no-undefined} zur Anzeige von Temperaturen", "Sagen Sie mir die Temperatur in ${p_unit:no-undefined}"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_identity)
#_[utterances=["Wer sind Sie?", "Was sind Sie?", "Was ist Genie?", "Bist du Genie?", "Wie heißt du?", "Wie heißt du?", "Wie heißt du?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_age)
#_[utterances=["Wie alt bist du?", "Wann wurden Sie geboren?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_how_are_you)
#_[utterances=["Wie geht's?", "Wie geht es u?", "Wie geht's dir?", "Wie geht es dir?", "Wie geht es dir heute?", "Wie geht es dir heute?", "Wie fühlst du dich heute?", "Wie fühlst du dich heute?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_location)
#_[utterances=["Wo sind Sie?", "Wo sind Sie jetzt?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_comparison)
#_[utterances=["Bist du besser als Cortana?", "Bist du besser als Siri?", "Bist du besser als Alexa?", "Sind Sie besser als Google?", "Sind Sie besser als Google Assistant?", "Sind Sie besser als Google Home?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_training)
#_[utterances=["Bist du gut im Training?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_partner)
#_[utterances=["Haben Sie einen Partner?", "Haben Sie einen bedeutenden anderen?", "Haben Sie einen GF?", "Hast du eine Freundin?", "Haben Sie einen Bf?", "Hast du einen Freund?", "Hast du einen Freund?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_junk)
#_[utterances=["Weißt du, was Porno ist?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum about_almond_preference)
#_[utterances=["Was ist dein Lieblingslied?", "Was ist dein Lieblingsfilm?", "Was ist dein Lieblingsbuch?", "Was ist dein Lieblingslied?", "Was ist dein Lieblingsfilm?", "Was ist dein Lieblingsbuch?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum check_capability_home_assistant)
#_[utterances=["Arbeiten Sie mit Home Assistant?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum check_capability_phone)
#_[utterances=["Unterstützen Sie irgendwelche Telefone?", "Welche Handys unterstützen Sie?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum general_help)
#_[utterances=["Was kannst du tun?", "Was kann ich tun?", "Was kannst du für mich tun?", "Hilfe!", "Befehle auflisten", "Hilfefähigkeit", "Was soll ich sagen?", "Was machst du?", "Was können Sie tun?", "Was kann u tun?", "Was soll ich tun?", "Welchen Befehl gibt es?", "Welche Fähigkeiten gibt es?", "Was kannst du überhaupt tun?", "Was könntest du für mich tun?", "Befehle:", "Geräte:", "Beispiele:", "Können Sie mir noch einen Vorschlag machen?", "Fähigkeiten anzeigen"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum iot_help)
#_[utterances=["Was für IoT-Geräte", "Mit welchen IoT-Geräten können Sie arbeiten?", "Mit welchen Geräten kann ich Sie verbinden?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum positive_emotion_thanks)
#_[utterances=["Lol", "Kühl", "Schön", "Ich liebe dich", "Großartig", "Gute Arbeit", "Sehr lustig", "Super", ":- )", ":o", "Guter Junge", "Du bist unglaublich"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum positive_emotion_cool)
#_[utterances=["Lustig", "- Ich weiß", "Wow! - Was ist das?", "- Ich weiß", "Lustig haha", "Ich liebe Programmieren"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum abusive)
#_[utterances=["Du bist scheiße", "Töte dich selbst", "Geh sterben", "Leck mich am Arsch!"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum revoke_consent)
#_[utterances=["Wiedererweckte Zustimmung", "Hör auf, meine Befehle aufzuzeichnen"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_train)
#_[utterances=["Wie lerne ich dich?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_configure_skill)
#_[utterances=["Was bedeutet es, etwas zu konfigurieren?", "Wie konfiguriere ich neue Fähigkeiten?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_disable_skill)
#_[utterances=["Wie kann ich eine Fähigkeit deaktivieren?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_set_language)
#_[utterances=["Wie ändere ich die Sprache?", "Welche Sprachen kennst du?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_access_settings)
#_[utterances=["Wo sind Genie-Einstellungen?", "Wie man Präferenzen ändert?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum how_to_use_wakeword)
#_[utterances=["Wie verwende ich Sprachbefehle?", "Wie verwende ich Hotword-Erkennung?", "Wie verwende ich Weckworterkennung?", "Was ist das Weckwort?", "Wie kann ich Audio aktivieren?"]];

program = @org.thingpedia.builtin.thingengine.builtin.faq_reply(question=enum troubleshooting_home_assistant)
#_[utterances=["Hilfe bei der Erkennung von Home Assistant Entities"]];
}
Loading

0 comments on commit 4c1f15a

Please sign in to comment.