Пример #1
0
def main(data):
    wordList = data.split()
    things = " ".join(wordList[0:wordIndex(data, "near")])
    if " me" in data:
        city = 0
    else:
        wordList = data.split()
        city = " ".join(wordList[wordIndex(data, "near") + 1:])
        print city
    mapps.searchNear(things, city)
Пример #2
0
def main(data):
    word_list = data.split()
    things = " ".join(word_list[0:wordIndex(data, "|")])
    if " me" in data:
        city = 0
    else:
        word_list = data.split()
        city = " ".join(word_list[wordIndex(data, "|") + 1:])
        print(city)
    mapps.search_near(things, city)
Пример #3
0
 def near():
     """
     Jarvis can find what is near you!
     """
     wordList = data.split()
     things = " ".join(wordList[0:wordIndex(data, "near")])
     if " me" in data:
         city = 0
     else:
         wordList = data.split()
         city = " ".join(wordList[wordIndex(data, "near") + 1:])
         print city
     mapps.searchNear(things, city)
Пример #4
0
def main(data):
    word_list = data.split()
    to_index = wordIndex(data, "to")
    if " from " in data:
        from_index = wordIndex(data, "from")
        if from_index > to_index:
            to_city = " ".join(word_list[to_index + 1:from_index])
            from_city = " ".join(word_list[from_index + 1:])
        else:
            from_city = " ".join(word_list[from_index + 1:to_index])
            to_city = " ".join(word_list[to_index + 1:])
    else:
        to_city = " ".join(word_list[to_index + 1:])
        from_city = 0
    mapps.directions(to_city, from_city)
Пример #5
0
def main(data):
    word_list = data.split()
    try:
        things = " ".join(word_list[0:wordIndex(data, "|")])
    except ValueError:
        cmd = CmdInterpreter.CmdInterpreter("", "")
        cmd.help_near()
        return

    if " me" in data:
        city = 0
    else:
        word_list = data.split()
        city = " ".join(word_list[wordIndex(data, "|") + 1:])
        print(city)
    mapps.search_near(things, city)
Пример #6
0
 def directions():
     """
     Get directions about a destination you are interested to.
     """
     wordList = data.split()
     to_index = wordIndex(data, "to")
     if " from " in data:
         from_index = wordIndex(data, "from")
         if from_index > to_index:
             toCity = " ".join(wordList[to_index + 1:from_index])
             fromCity = " ".join(wordList[from_index + 1:])
         else:
             fromCity = " ".join(wordList[from_index + 1:to_index])
             toCity = " ".join(wordList[to_index + 1:])
     else:
         toCity = " ".join(wordList[to_index + 1:])
         fromCity = 0
     mapps.directions(toCity, fromCity)