Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'refs/heads/master' of

ssh://git@github.com/phyrex1an/PathPal.git
  • Loading branch information...
commit af9799294041d0a638a4687f4686c0afabf1db7d 2 parents d91deae + c69cfd0
@phyrex1an authored
View
BIN  res/raw/locator.pgf
Binary file not shown
View
10 src/org/pathpal/TranslatorApi.java
@@ -21,7 +21,15 @@ public static boolean translateString(String inputString, DirectionsForm form, I
form.travelTo(((FunString) f.getArgs().get(1)).getString());
} else if (f.getIdent().equals("GoTo")) {
form.travelTo(((FunString) f.getArgs().get(0)).getString());
- }
+ } else if (f.getIdent().equals("GoByCarTo")) {
+ form.travelTo(((FunString) f.getArgs().get(0)).getString());
+ form.byCar();
+ } else if (f.getIdent().equals("GoByCarFromTo")) {
+ form.startAt(((FunString) f.getArgs().get(0)).getString());
+ form.travelTo(((FunString) f.getArgs().get(1)).getString());
+ form.byCar();
+ }
+
return true;
}
View
3  src/org/pathpal/grammar/Locator.gf
@@ -8,6 +8,9 @@ abstract Locator = {
fun
GoTo : Dummy -> Phrase ;
+ GoByCarTo : Dummy -> Phrase ;
+ GoByCarFromTo : Dummy -> Dummy -> Phrase ;
+ WalkTo : Dummy -> Phrase;
DString : Dummy ;
GoFromTo : Dummy -> Dummy -> Phrase;
FindStore : StoreType -> Phrase ;
View
BIN  src/org/pathpal/grammar/Locator.gfo
Binary file not shown
View
6 src/org/pathpal/grammar/LocatorEng.gf
@@ -3,6 +3,11 @@ concrete LocatorEng of Locator = {
Phrase,StoreType,Answer,Dummy= {s : Str} ;
lin
GoTo it = {s = "I need to go to" ++ it.s} ;
+ GoByCarTo it = {s = "I want to go by car to" ++ it.s} ;
+ GoByCarFromTo i i' = {s = "I want to go by car from" ++ i.s ++ "to" ++ i'.s} ;
+
+ WalkTo it = {s = "I want to walk to" ++ it.s} ;
+
GoFromTo it it' = {s = "I need to go from" ++ it.s ++ "to" ++ it'.s} ;
FindStore it = {s = "Where is the nearest" ++ it.s ++ "store"} ;
@@ -11,5 +16,6 @@ concrete LocatorEng of Locator = {
WalkOrTrans item = {s = item.s} ;
Walking = {s = "Walking"} ;
+
Transportation = {s = "Transportation"} ;
}
View
BIN  src/org/pathpal/grammar/LocatorEng.gfo
Binary file not shown
View
7 src/org/pathpal/grammar/LocatorSwe.gf
@@ -2,8 +2,11 @@ concrete LocatorSwe of Locator = {
lincat
Phrase,StoreType,Answer,Dummy= {s : Str} ;
lin
- GoTo it = {s = "Jag måste gå till" ++ it.s} ;
- GoFromTo i i' = {s = "Jag måste gå från" ++ i.s ++ "till" ++ i'.s} ;
+ GoTo it = {s = "Jag vill till" ++ it.s} ;
+ GoByCarTo it = {s = "Jag vill åka bil till" ++ it.s} ;
+ WalkTo it = {s = "Jag vill gå till " ++ it.s} ;
+
+ GoFromTo i i' = {s = "Jag vill från" ++ i.s ++ "till" ++ i'.s} ;
FindStore item = {s = "Var är närmaste" ++ item.s} ;
DString = {s = "dummy"} ;
View
BIN  src/org/pathpal/grammar/LocatorSwe.gfo
Binary file not shown
View
19 src/org/pathpal/grammar/_grph.dot
@@ -1,19 +0,0 @@
-graph {
-n0[label = "GoFromTo : Phrase", style = "solid", shape = "plaintext"] ;
-n0_0[label = "AdressT : AdressTree", style = "solid", shape = "plaintext"] ;
-n0 -- n0_0 [style = "solid"];
-n0_0_0[label = "\"Kalle\"", style = "solid", shape = "plaintext"] ;
-n0_0 -- n0_0_0 [style = "solid"];
-n1_0_0[label = "AdressT : AdressTree", style = "solid", shape = "plaintext"] ;
-n0_0 -- n1_0_0 [style = "solid"];
-n0_1_0_0[label = "\"Anka\"", style = "solid", shape = "plaintext"] ;
-n1_0_0 -- n0_1_0_0 [style = "solid"];
-n1_1_0_0[label = "AdressL : AdressTree", style = "solid", shape = "plaintext"] ;
-n1_0_0 -- n1_1_0_0 [style = "solid"];
-n0_1_1_0_0[label = "\"klubben\"", style = "solid", shape = "plaintext"] ;
-n1_1_0_0 -- n0_1_1_0_0 [style = "solid"];
-n1_0[label = "AdressL : AdressTree", style = "solid", shape = "plaintext"] ;
-n0 -- n1_0 [style = "solid"];
-n0_1_0[label = "\"Brunnsparken\"", style = "solid", shape = "plaintext"] ;
-n1_0 -- n0_1_0 [style = "solid"];
-}
View
BIN  src/org/pathpal/grammar/_grph.png
Deleted file not rendered
View
14 src/org/pathpal/test/translateStringTest.java
@@ -17,9 +17,15 @@
public void testTranslateString() throws FileNotFoundException, IOException, UnknownLanguageException{
MockDirectionsForm form = new MockDirectionsForm();
InputStream st = new FileInputStream("res/raw/locator.pgf") ;
- assertTrue(TranslatorApi.translateString("I need to go from abc to def",form,st));
- assertTrue(form.startAt.equals("abc"));
- assertTrue(form.travelTo.equals("def"));
+ /*
+ assertTrue(TranslatorApi.translateString("I want to go by car to abc",form,st));
+ assertTrue(form.travelTo.equals("abc"));
+ assertTrue(form.byCar == true);
+ */
+ assertTrue(TranslatorApi.translateString("I want to go by car from Dixon to Trixon",form,st));
+ assertTrue(form.travelTo.equals("Trixon"));
+ assertTrue(form.startAt.equals("Dixon"));
+ assertTrue(form.byCar == true);
}
@@ -27,7 +33,9 @@ public void testTranslateString() throws FileNotFoundException, IOException, Unk
{
public String travelTo;
public String startAt;
+ public boolean byCar;
public MockDirectionsForm() { super(null); }
+ public void byCar(){byCar = true;}
public DirectionsForm travelTo(String t) { travelTo = t; return this; }
public DirectionsForm startAt(String t) { startAt = t; return this; }
}
Please sign in to comment.
Something went wrong with that request. Please try again.