I've been trying to get speech recognition to work on a Java application, I've tried Sphinx but it's too complex for what I need, so I found Voce.
I'm trying to get the recognition demo to work.
The problem is I can't initialize the SpeechInterface, here's the code I've been using:
voce.SpeechInterface.init("C:/Users/G/Documents/NetBeansProjects/VoceTest/lib",
false,
true,
"C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram",
"digits");
I have a grammar file named digits.gram in the gram folder inside the lib folder.
As a result I get:
[Voce ERROR] Cannot configure speech recognizer:
Property Exception component:'jsgfGrammar' property:'grammarLocation' - value (C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram) is not a valid Resource
at edu.cmu.sphinx.util.props.ValidatingPropertySheet.setRaw(ValidatingPropertySheet.java:137)
at edu.cmu.sphinx.util.props.ConfigurationManager.setProperty(ConfigurationManager.java:250)
at voce.SpeechRecognizer.<init>(SpeechRecognizer.java:85)
at voce.SpeechInterface.init(SpeechInterface.java:79)
at vocetest.VoceTest.main(VoceTest.java:18)
I read the docs but I can't figure out what I'm doing wrong
"file:/C:/Users/G/Documents/NetBeansProjects/VoceTest/lib/gram","digits");"
The above line should work without errors.
Related
I'm trying the quickstart from here: http://datafu.incubator.apache.org/docs/datafu/getting-started.html
I tried nearly everything, but I'm sure it must be my fault somewhere. I tried already:
exporting PIG_HOME, CLASSPATH, PIG_CLASSPATH
starting pig with -cpdatafu-pig-incubating-1.3.0.jar
registering datafu-pig-incubating-1.3.0.jar locally and in hdfs => both succesful (at least no error shown)
nothing helped
Trying this on pig:
register datafu-pig-incubating-1.3.0.jar
DEFINE Median datafu.pig.stats.StreamingMedian();
data = load '/user/hduser/numbers.txt' using PigStorage() as (val:int);
data2 = FOREACH (GROUP data ALL) GENERATE Median(data);
or directly
data2 = FOREACH (GROUP data ALL) GENERATE datafu.pig.stats.StreamingMedian(data);
I get this name-resolve error:
2016-06-04 17:22:22,734 [main] ERROR org.apache.pig.tools.grunt.Grunt
- ERROR 1070: Could not resolve datafu.pig.stats.StreamingMedian using imports: [, java.lang., org.apache.pig.builtin.,
org.apache.pig.impl.builtin.] Details at logfile:
/home/hadoop/pig_1465053680252.log
When I look into the datafu-pig-incubating-1.3.0.jar it looks OK, everything in place. I also tried some Bag functions, same error then.
I think it's kind of a noob-error which I just don't see (as I did not find particular answers for datafu in SO or google), so thanks in advance for shedding some light on this.
Pig script is proper, the only thing that could break is that while registering datafu there were some class dependencies that coudn't been met.
Try to run locally (pig -x local) and see a detailed log.
Check also the version of pig - it should be newer than 0.14.0.
I want to use synonyms () described in 'Intro to the tm package' for R. It uses the wordnet package. The wordnet package downloaded from CRAN does not have Dict (dictionary) in its directory. I downloaded it from the Princeton site and copied it over to the directory. After using sys.setenv() and setDict() for setting paths, I still get this error:
Error in sort(unique(unlist(lapply(synsets, getWord))))
error in evaluating the argument 'x' in selecting a method for function 'sort': Error in unique(unlist(lapply(synsets, getWord))) :
error in evaluating the argument 'x' in selecting a method for function 'unique': Error in .jcall(synset, "Ljava/util/List;", "getWord") :
java.lang.NumberFormatException: For input string: "t"
when I try synonyms("company", pos = "NOUN") or another English word in place of 'company'. The problem is in getSynonyms() called from synonyms(). Any idea on how to fix this problem?
Different combinations lead to different input string NumberFormatException. My Java is version 1.8. I tried all the online resources. I added two paths to PATH for R's bin and RJava's jri. Discussion on the exception indicates it is a string to numeric conversion issue. I have made sure that Java to R linkage (via rJava) works (URL: https://www.rforge.net/rJava/ ).
Code is in Scala. It is extremely similar to Java code.
Code that our map indexer uses to create index: https://gist.github.com/a16e5946b67c6d12b2b8
Utilities that the above code uses to create index and mapping: https://gist.github.com/4f88033204cd761abec0
Errors that java gives: https://gist.github.com/d6c835233e2b606a7074
Response of http://elasticsearch.domain/maps/_settings after running code and getting errors: https://gist.github.com/06ca7112ce1b01de3944
JSON FILES:
https://gist.github.com/bbab15d699137f04ad87
https://gist.github.com/73222e300be9fffd6380
Attached are the json files i'm loading in. I have confirmed that it is loading the right json files and properly outputting it as a string into .loadFromSource and .setSource.
Any ideas why it can't find the analyzers even though they are in _settings? If I run these json files via curl they work fine and properly setup the mapping.
The code I was using to create the index (found here: Define custom ElasticSearch Analyzer using Java API) was creating settings in the index like:
"index.settings.analysis.filter.my_snow.type: "stemmer","
It had settings in the setting path.
I changed my indexing code to the following to fix this:
def createIndex(client: Client, indexName: String, indexFile: String) {
//Create index
client.admin().indices().prepareCreate(indexName)
.setSource(Utils.loadFileAsString(indexFile))
.execute()
.actionGet()
}
I tried setting up a BigQuery project with a JAVA API to access it. But when I run the google BigQueryInstalledAuthDemo class which is here, I get this error :
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at com.google.api.client.json.jackson.JacksonFactory.createJsonParser(JacksonFactory.java:70)
at com.google.api.client.json.JsonFactory.fromInputStream(JsonFactory.java:223)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(GoogleClientSecrets.java:167)
at BigQueryLocal.loadClientSecrets(BigQueryLocal.java:99)
at BigQueryLocal.<clinit>(BigQueryLocal.java:31)
Exception in thread "main" java.lang.NullPointerException
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl. <init>(GoogleAuthorizationCodeRequestUrl.java:111)
at BigQueryLocal.main(BigQueryLocal.java:47)
Which I don't understand, my JSON file is in the same folder than the class (I tried both relative and absolute paths)
My JSON file is like this :
{
"installed": {
"client_id": "XXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com",
"client_secret": "XXXXXXXXXXXXXXXXX",
"redirect_uris": ["urn:ietf:oauth:2.0:oob"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}
I use the google API library 1.12-beta and java 1.6.
So, I don't understand why I have this error right there :(, so if anyone has an idea...
Thank you :)
Which IDE are you using? This tends to happen when your code can't locate the resource, because it is in the wrong directory, or is in a directory that your app doesn't consider a resource.
There's a lot of info on Stack Overflow about handling this, for example:
Where to put a textfile I want to use in eclipse?
I'm new in "Play! Framework" and I'm trying to do a i18n for pt-BR.
My message file is called 'Message.pt-BR' and i put the pt-BR lang in application.conf.
In Java I'm using something like this:
flash("success", Messages.get("logout.success"));
And in scala.html files I'm using this:
#Messages("logout")
In my Message.pt-BR file I've this:
logout=Sair
logout.success=Logout realizado com sucesso. Volte sempre!
When I compile the project I have no errors, but when I request some page a have this error:
`=' expected but `-' found
Messages.pt-BR
Someone can help me?
I think you have to rename your message file from Messages.pt-BR to Messages.pt_BR (with a lower '_').