Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added Time and Weather Portuguese Plugins

  • Loading branch information...
commit ff8c39c39748e9e79edf1f064cf1a471a4943aab 1 parent 1788ef2
@edsonaj authored
View
2  PluginManager.conf
@@ -10,4 +10,6 @@ jardim
portugues
salaestar
Anotacoes
+time
+weather
startRequestHandler
View
70 plugins/Cópia de portugues.py
@@ -0,0 +1,70 @@
+#!/usr/bin/python
+# -*- coding: utf-8 -*-
+
+from plugin import *
+
+class portugues(Plugin):
+
+ @register("pt-BR", "(.*Oi.*)|(.*Oi Siri.*)")
+ def st_hello(self, speech, language):
+ self.say("Ola","Hello")
+ self.complete_request()
+
+ @register("pt-BR", "(.*seu nome.*)")
+ def st_name(self, speech, language):
+ self.say("Meu nome e Siri.","My name is Siri.")
+ self.complete_request()
+
+ @register("pt-BR", "(.*Como.*est.*)")
+ def st_howareyou(self, speech, language):
+ self.say("Muito bem, obrigada por perguntar!","Fine, thanks for asking!")
+ self.complete_request()
+
+ @register("pt-BR", ".*Obrigado.*")
+ def st_thank_you(self, speech, language):
+ self.say("De nada. E apenas meu trabalho.","You are welcome. This is my job")
+ self.complete_request()
+
+ @register("pt-BR", "(.*quer.*casar.*)|(.*vamos.*casar.*)")
+ def st_marry_me(self, speech, language):
+ self.say("Nao, obrigada. Eu estou apaixonada pelo iPhone preto do seu amigo.","No, thank you. I'm in love with the black iPhone from your friend.")
+ self.complete_request()
+
+ @register("pt-BR", "(.*conte.*piada*)|(.*contar.*piada.*)")
+ def st_tell_joke(self, speech, language):
+ self.say("Dois iPhones entraram em um bar ... Esqueci o resto.","Two iPhones walk into a bar ... I forget the rest.")
+ self.complete_request()
+
+ @register("pt-BR", ".*significado.*vida.*")
+ def st_tell_life(self, speech, language):
+ self.say("Eu nao sei, mas deve ter algum app para isso.","I don't know, but it should have an app for that")
+ self.complete_request()
+
+ @register("pt-BR", ".*knock.*knock.*")
+ def st_knock(self, speech, language):
+ answer = self.ask(u"Quem esta ai?")
+ answer = self.ask(u"\"{0}\" quem?".format(answer))
+ self.say("Quem esta brincando comigo?","Who is bugging me with knock knock jokes?")
+ self.complete_request()
+
+ @register("pt-BR", ".*Questão.*Vida.*")
+ def st_anstwer_all(self, speech, language):
+ self.say("42")
+ self.complete_request()
+
+ @register("pt-BR", "(.*te amo.*)|(.*amo você.*)")
+ def st_love_you(self, speech, language):
+ self.say("Ah, claro, eu aposto que você fala isso para todos os seus produtos Apple.","Oh. Sure, I guess you say this to all your Apple products")
+ self.complete_request()
+
+ @register("pt-BR", ".*Feliz anivers.*")
+ def st_birthday(self, speech, language):
+ self.say("Meu aniversario e hoje?","My birthday is today?")
+ self.say("Vamos fazer uma festa!","Lets make a party!")
+ self.complete_request()
+
+ @register("pt-BR", ".*estou.*cansado.*")
+ def st_so_tired(self, speech, language):
+ self.say("Eu espero que voce nao esteja dirigindo neste momento!","I hope you are not driving a car right now!")
+ self.complete_request()
+
View
20 plugins/time.py
@@ -48,14 +48,14 @@ def to_plist(self):
class time(Plugin):
localizations = {"currentTime":
- {"search":{"de-DE": "Es wird gesucht ...", "en-US": "Looking up ..."},
- "currentTime": {"de-DE": "Es ist @{fn#currentTime}", "en-US": "It is @{fn#currentTime}"}},
+ {"search":{"de-DE": "Es wird gesucht ...", "en-US": "Procurando ..."},
+ "currentTime": {"de-DE": "Es ist @{fn#currentTime}", "en-US": "Sao @{fn#currentTime}"}},
"currentTimeIn":
- {"search":{"de-DE": "Es wird gesucht ...", "en-US": "Looking up ..."},
+ {"search":{"de-DE": "Es wird gesucht ...", "en-US": "Procurando ..."},
"currentTimeIn":
{
- "tts": {"de-DE": u"Die Uhrzeit in {0},{1} ist @{{fn#currentTimeIn#{2}}}:", "en-US": "The time in {0},{1} is @{{fn#currentTimeIn#{2}}}:"},
- "text": {"de-DE": u"Die Uhrzeit in {0}, {1} ist @{{fn#currentTimeIn#{2}}}:", "en-US": "The time in {0}, {1} is @{{fn#currentTimeIn#{2}}}:"}
+ "tts": {"de-DE": u"Die Uhrzeit in {0},{1} ist @{{fn#currentTimeIn#{2}}}:", "en-US": "The time in {0}, {1} is @{{fn#currentTimeIn#{2}}}:"},
+ "text": {"de-DE": u"Die Uhrzeit in {0}, {1} ist @{{fn#currentTimeIn#{2}}}:", "en-US": "As horas em {0}, {1} sao @{{fn#currentTimeIn#{2}}}:"}
}
},
"failure": {
@@ -64,7 +64,7 @@ class time(Plugin):
}
@register("de-DE", "(Wie ?viel Uhr.*)|(.*Uhrzeit.*)")
- @register("en-US", "(What.*time.*)|(.*current time.*)")
+ @register("en-US", "(Que horas sao*)|(.*Horas.*)|(.*Hora.*)")
def currentTime(self, speech, language):
#first tell that we look it up
view = AddViews(self.refId, dialogPhase="Reflection")
@@ -82,7 +82,7 @@ def currentTime(self, speech, language):
self.complete_request()
@register("de-DE", "(Wieviel Uhr.*in ([\w ]+))|(Uhrzeit.*in ([\w ]+))")
- @register("en-US", "(What.*time.*in ([\w ]+))|(.*current time.*in ([\w ]+))")
+ @register("en-US", "(Que horas sao.*em ([\w ]+))|(.*Horas.*em ([\w ]+))")
def currentTimeIn(self, speech, language):
view = AddViews(self.refId, dialogPhase="Reflection")
view.views = [AssistantUtteranceView(text=time.localizations['currentTimeIn']['search'][language], speakableText=time.localizations['currentTimeIn']['search'][language], dialogIdentifier="Clock#getTime")]
@@ -179,9 +179,9 @@ def currentTimeIn(self, speech, language):
# "properties"=>
# {"dialogIdentifier"=>"Common#unresolvedExplicitLocation",
# "speakableText"=>
-# "Ich weiß leider nicht, wo das ist. Wenn du möchtest, kann ich im Internet danach suchen.",
+# "Ich weiß leider nicht, wo das ist. Wenn du möchtest, kann ich im Internet danach suchen.",
# "text"=>
-# "Ich weiß leider nicht, wo das ist. Wenn du möchtest, kann ich im Internet danach suchen."},
+# "Ich weiß leider nicht, wo das ist. Wenn du möchtest, kann ich im Internet danach suchen."},
# "group"=>"com.apple.ace.assistant"},
# {"class"=>"Button",
# "properties"=>
@@ -200,4 +200,4 @@ def currentTimeIn(self, speech, language):
# "group"=>"com.apple.ace.assistant"}]},
# "aceId"=>"fbec8e13-5781-4b27-8c36-e43ec922dda3",
# "refId"=>"702C0671-DB6F-4914-AACD-30E84F7F7DF3",
-# "group"=>"com.apple.ace.assistant"}
+# "group"=>"com.apple.ace.assistant"}
View
46 plugins/weather.py
@@ -14,7 +14,7 @@
from siriObjects.forecastObjects import *
#Obtain API Key from wundergrounds.com
-weatherApiKey =""
+weatherApiKey ="e63c15987206e33d"
class SiriWeatherFunctions():
def __init__(self):
@@ -44,34 +44,34 @@ def swapCondition(self,conditionTerm="clear", night=False):
class weatherPlugin(Plugin):
localizations = {"weatherForecast":
{"search":{
- 0:{"de-DE": u"Einen Moment Geduld bitte...", "en-US": "Checking my sources..."},
- 1:{"de-DE": u"Ich suche nach der Vorhersage ...", "en-US": "Please wait while I check that..."},
- 2:{"de-DE": u"Einen Moment bitte ...", "en-US": "One moment please..."},
- 3:{"de-DE": u"Ich suche nach Wetterdaten...", "en-US": "Trying to get weather data for this location..."},
+ 0:{"de-DE": u"Einen Moment Geduld bitte...", "en-US": "Checando minhas fontes..."},
+ 1:{"de-DE": u"Ich suche nach der Vorhersage ...", "en-US": "Por favor espere enquanto checo..."},
+ 2:{"de-DE": u"Einen Moment bitte ...", "en-US": "Um momento por favor..."},
+ 3:{"de-DE": u"Ich suche nach Wetterdaten...", "en-US": "Tentando obter a previsao..."},
},
"forecast":{
"DAILY": {
- 0:{"de-DE": u"Hier ist die Vorhersage für {0}, {1}", "en-US": "Here is the forecast for {0}, {1}"},
- 1:{"de-DE": u"Hier ist die Wetterprognose für {0}, {1}", "en-US": "This is the forecast for {0}, {1}"},
- 2:{"de-DE": u"Ich habe folgende Vorhersage für {0}, {1} gefunden", "en-US": "I found the following forecast for {0}, {1}"},
+ 0:{"de-DE": u"Hier ist die Vorhersage für {0}, {1}", "en-US": "O tempo hoje em {0}, {1} é"},
+ 1:{"de-DE": u"Hier ist die Wetterprognose für {0}, {1}", "en-US": "Este e a previsao para {0}, {1}"},
+ 2:{"de-DE": u"Ich habe folgende Vorhersage für {0}, {1} gefunden", "en-US": "Eu achei a seguinte informacao sobre o tempo para {0}, {1}"},
},
"HOURLY": {
- 0:{"de-DE": u"Hier ist die heutige Vorhersage für {0}, {1}", "en-US": "Here is today's forecast for {0}, {1}"},
- 1:{"de-DE": u"Hier ist die Wetterprognose von heute für {0}, {1}", "en-US": "This is today's forecast for {0}, {1}"},
- 2:{"de-DE": u"Ich habe folgende Tagesprognose für {0}, {1} gefunden", "en-US": "I found the following hourly forecast for {0}, {1}"},
+ 0:{"de-DE": u"Hier ist die heutige Vorhersage für {0}, {1}", "en-US": "O tempo hoje em {0}, {1} e"},
+ 1:{"de-DE": u"Hier ist die Wetterprognose von heute für {0}, {1}", "en-US": "Este e a previsao para {0}, {1}"},
+ 2:{"de-DE": u"Ich habe folgende Tagesprognose für {0}, {1} gefunden", "en-US": "Eu achei a seguinte informacao sobre o tempo para {0}, {1}"},
}
},
"failure": {
- "de-DE": "Ich konnte leider keine Wettervorhersage finden!", "en-US": "I'm sorry but I could not find the forecast for this location!"
+ "de-DE": "Ich konnte leider keine Wettervorhersage finden!", "en-US": "Me desculpe, mais nao acho a previsao para esta localidade!"
}
}
}
@register("de-DE", "(.*Wetter.*)|(.*Vorhersage.*)")
- @register("en-US", "(.*Weather.*)|(.*forecast.*)")
+ @register("en-US", "(.*Weather.*)|(.*Tempo.*)")
def weatherForecastLookUp(self, speech, language):
if weatherApiKey =="":
- self.say("Please obtain an API key from http://api.wunderground.com/weather/api/ and enter it in line 17!")
+ self.say("Por favor obtenha a chave API em http://api.wunderground.com/weather/api/ e coloque-a na linha 17!")
self.complete_Request()
pass
viewType ="DAILY"
@@ -83,25 +83,25 @@ def weatherForecastLookUp(self, speech, language):
speech = speech.replace("current","")
speech = speech.replace(" for today"," in ")
speech = speech.replace(" for "," in ")
- if (speech.count("heute") > 0 or speech.count("moment") > 0 or speech.count(u"nächsten Stunden") > 0 or speech.count(u"für heute") > 0) and language=="de-DE":
+ if (speech.count("heute") > 0 or speech.count("moment") > 0 or speech.count(u"nächsten Stunden") > 0 or speech.count(u"für heute") > 0) and language=="de-DE":
viewType = "HOURLY"
speech = speech.replace("heute","")
speech = speech.replace("im moment","")
speech = speech.replace("momentan","")
speech = speech.replace("aktuelle","")
speech = speech.replace("aktuell","")
- speech = speech.replace(u"in den nächsten Stunden","")
- speech = speech.replace(u"für heute","")
+ speech = speech.replace(u"in den nächsten Stunden","")
+ speech = speech.replace(u"für heute","")
if language=="en-US":
speech = speech.replace(" for "," in ")
if language=="de-DE":
- speech = speech.replace(u"in den nächsten Tagen","")
- speech = speech.replace(u"in den nächsten paar Tagen","")
- speech = speech.replace(u"in der nächsten Woche","")
- speech = speech.replace(u"nächste Woche","")
- speech = speech.replace(u" für "," in ")
+ speech = speech.replace(u"in den nächsten Tagen","")
+ speech = speech.replace(u"in den nächsten paar Tagen","")
+ speech = speech.replace(u"in der nächsten Woche","")
+ speech = speech.replace(u"nächste Woche","")
+ speech = speech.replace(u" für "," in ")
error = False
@@ -116,7 +116,7 @@ def weatherForecastLookUp(self, speech, language):
- countryOrCity = re.match("(?u).* in ([\w ]+)", speech, re.IGNORECASE)
+ countryOrCity = re.match("(?u).*em ([\w ]+)", speech, re.IGNORECASE)
if countryOrCity != None:
countryOrCity = countryOrCity.group(1).strip()
print "found forecast"
Please sign in to comment.
Something went wrong with that request. Please try again.