Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
yotta
/
pictogram
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
60
Merge Requests
0
Pipelines
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
ee7b23b5
authored
Jun 07, 2016
by
Fernando Martínez Santiago
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
working on GF integration (iii)
parent
d87d1ca8
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
11 deletions
android/Pictogram/app/src/fernandoFlavor/java/com/yottacode/pictogrammar/Translate.java
android/Pictogram/build.gradle
android/Pictogram/gradle/wrapper/gradle-wrapper.properties
android/Pictogram/app/src/fernandoFlavor/java/com/yottacode/pictogrammar/Translate.java
View file @
ee7b23b5
...
...
@@ -12,17 +12,21 @@ package com.yottacode.pictogrammar;
import
android.app.ProgressDialog
;
import
android.os.AsyncTask
;
import
android.widget.Toast
;
import
java.io.FileNotFoundException
;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.util.Map
;
import
java.util.Vector
;
import
org.grammaticalframework.sg.SG
;
import
org.grammaticalframework.pgf.*
;
import
com.yottacode.pictogram.dao.PCBDBHelper
;
import
com.yottacode.pictogram.tools.PCBcontext
;
import
com.yottacode.pictogram.tts.TTSHelper
;
import
com.yottacode.pictogram.R
;
...
...
@@ -30,7 +34,7 @@ package com.yottacode.pictogrammar;
public
class
Translate
extends
Activity
{
private
ArrayAdapter
mArrayAdapter
;
private
PGF
mPGF
;
private
PGF
mPGF
;
private
TTSHelper
tts
;
private
GrammarLoader
mGrammarLoader
;
private
ConcrLoader
mSourceLoader
;
...
...
@@ -190,18 +194,22 @@ public class Translate extends Activity
int
i
=
0
;
for
(
ExprProb
ep
:
eng
.
parse
(
mPGF
.
getStartCat
(),
"I want chips"
))
{
for
(
ExprProb
ep
:
eng
.
parse
(
mPGF
.
getStartCat
(),
"I want
salty
chips"
))
{
if
(
i
++>
5
)
break
;
Log
.
i
(
this
.
getClass
().
getSimpleName
(),
"
["
+
ep
.
getProb
()
+
"] "
+
ep
.
getExpr
());
Log
.
e
(
this
.
getClass
().
getSimpleName
(),
"Next:
["
+
ep
.
getProb
()
+
"] "
+
ep
.
getExpr
());
}
i
=
0
;
for
(
TokenProb
tk
:
eng
.
complete
(
mPGF
.
getStartCat
(),
""
,
"I want"
))
{
if
(
i
++>
5
)
break
;
i
=
0
;
java
.
util
.
Vector
<
Integer
>
categories
=
new
Vector
<>();
for
(
TokenProb
tk
:
eng
.
complete
(
mPGF
.
getStartCat
(),
"I want salty"
,
""
))
{
String
translation
=
tk
.
getToken
();
Log
.
i
(
this
.
getClass
().
getSimpleName
(),
"Next: "
+
translation
);
Log
.
i
(
this
.
getClass
().
getSimpleName
(),
"Next: "
+
tk
.
getToken
()
+
". Prob. "
+
tk
.
getProb
());
}
}
catch
(
ParseError
e
)
{
Log
.
i
(
this
.
getClass
().
getSimpleName
(),
"Parsing failed at token \""
+
e
.
getToken
()+
"\""
);
Log
.
e
(
this
.
getClass
().
getSimpleName
(),
"Parsing failed at token \""
+
e
.
getToken
()+
"\""
);
}
}
catch
(
FileNotFoundException
e
)
{
...
...
android/Pictogram/build.gradle
View file @
ee7b23b5
...
...
@@ -5,7 +5,7 @@ buildscript {
jcenter
()
}
dependencies
{
classpath
'com.android.tools.build:gradle:
1.5
.0'
classpath
'com.android.tools.build:gradle:
2.1
.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
...
...
android/Pictogram/gradle/wrapper/gradle-wrapper.properties
View file @
ee7b23b5
#
Wed Apr 10 15:27:10 PDT 2013
#
Thu May 26 14:03:38 CEST 2016
distributionBase
=
GRADLE_USER_HOME
distributionPath
=
wrapper/dists
zipStoreBase
=
GRADLE_USER_HOME
zipStorePath
=
wrapper/dists
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.
2.1
-all.zip
distributionUrl
=
https
\:
//services.gradle.org/distributions/gradle-2.
10
-all.zip
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment