Speech Recognition in Clojure - text

I am new to clojure and am trying to use this library I found on github https://github.com/klutometis/speech-recognition
In the documentation it says to include a line of code inside a namespace but I am not sure of how to do that? Can anyone help?

use is a legacy function of Clojure
(:use [speech-recognition.hear :as hear])
is same as
(:require [speech-recognition.hear :as hear])

Related

Which IDE supports gtpl (groovy templates)?

So, IntelliJ/Idea can't seem to find time to support Groovy's templating language (IDEA-96594) - especially markuptemplateengine.
Which IDE supports GTPL's? Are there any?
just renaming ".gtpl" to ".gsp" will do the trick

GPars is part of Groovy but not in the API docs? Why can't I import?

http://www.gpars.org/guide/guide/gettingStarted.html#gettingStarted_downloadingAndInstalling
It says that GPars has been incorporated into Groovy. If so, why can't I find it in the API documentation for Groovy? Why is it that my import statements don't seem to be working? I see the library in my Groovy distro:
user#box /opt/stuff/groovy $ find . -name "*gpars*"
./lib/gpars-1.2.1.jar
user#box /opt/stuff/groovy $
gpars is indeed shipped with groovy distribution - as you can see under $GROOVY_HOME/lib - but it's still a separate library.
If you use groovysh or groovyConsole, gpars is automatically added to classpath and ready to use.
However if you need to use gpars in a separate application managed by gradle or maven you need to define a dependency to fetch and use gpars
You can also add this to the top of your Groovy script or in the Groovy console, which has built in support for Grape's #Grab annotation:
#Grab(group='org.codehaus.gpars', module='gpars', version='1.2.1')

What is imported using the Gjs imports statement?

If I'm looking at Gjs code and see this line near the beginning:
const Gio = imports.gi.Gio;
How can I know what methods, constants, events, etc. are on 'Gio' (without doing a Google search)? Is there a file somewhere on my installation that contains that information?
Obviously I'm asking for any 'imports' statement, not Gio specifically.
Some of imports statements import other javascript files:
imports.ui.* -> /usr/share/cinnamon/js/ui/*
imports.misc.* -> /usr/share/cinnamon/js/misc/*
imports.[cairo, dbus, format, gettext, jsUnit, lang, promise, signals] -> /usr/share/gjs-1.0/
For the imports.gi imports, Gnome Introspection is used to allow gjs to use C library.
So to get informations about those libraries I suggest you to look at the Gnome reference manuals:
Gio
Gtk
St
But to conclude, there is a huge lack of documentation and examples. That makes difficult to develop with gjs.
UPDATE
Here other useful links:
Seed documentation (seed is another javascript implementation for GNOME)
Gjs exemples
Since I got no answers I kept searching online and found this excellent blog post on how to generate HTML-formatted documentation from typelib files (such as Gio-2.0.typelib):
http://mathematicalcoffee.blogspot.com/2012/09/developing-gnome-shell-extensions_6.html

Tutorial for NodeJS's htmlparser?

I don't really understand the readme of htmlparser.. and I searched over the internet but cannot find a proper tutorial for it (or other NodeJS parsers).
I believe for most of the time if there's no tutorial for a pretty complete and old library it's mostly because that it's easy to do thus people don't really feel the need to write tutorial for it... But I found NodeJS html parser is pretty hard to understand...
You should check out htmlparser2. It's the newer htmlparser and it's got a decent readme. The way I tend to use it isn't streamish, and thus looks something like this:
handler = new htmlparser.DomHandler(function(err, dom) {
// ... DO CODE HERE
})
new htmlparser.Parser(handler).parseComplete(html_string)
For the code inside the handler function, I use soupselect because it's documented and I'm lazy, but htmlparser2 guys suggest domutils, but it has no documentation.

How to load a text file from within an XQuery?

Is there an XQuery command to load a text file?
I can load an xml document by doing the following;
declare variable $text := doc("test.xml");
But it only seems to work if test.xml is a well-formed xml document. What I want is to load a plain test.txt file into a string variable. Something like this;
declare variable $str as xs:string := fn:loadfile("test.txt");
Can it be done?
I'm using the Saxon engine but I can't find an answer in the saxon documentation.
Indeed you can find one implementation of the file functions in Zorba: http://www.zorba-xquery.com/doc/zorba-1.4.0/zorba/xqdoc/xhtml/www.zorba-xquery.com_modules_file.html
XQuery 3.0 has the function fn:unparsed-text (which was originally defined in XSLT), which does exactly what you want. XQuery 3.0 is still a work in progress though, but whilst there are not many XQuery 3.0 processors available, many XQuery processors already support this function (including Saxon).
There is a standardization effort for this on EXPath. A spec already exists for an XQuery File module that is capable of doing what you describe: EXPath File Module Spec.
Yet, I don't know how many implementations are out there. Saxon doesn't seem to implement it unfortunately (Or, please point me to it). An example implementation is shipped with zorba (see XQDoc Site of Zorba). If you want to know how to get started with zorba, you can check out this tutorial: Get Started with XQuery and Zorba.
XQuery by default( means fn: namespace ) doesn;t have any file-access methods.
MarkLogic :
xdmp:filesystem-file()
xdmp:filesystem-directory()
Zorba:
already mentioned by user457056
Exist
Exist File Module
Saxon since version 9.2 has an extension of fn:collection that can be used to read unparsed text. Here is an example:
collection('file:///c:/TEMP?select=text.txt;unparsed=yes')
This is described under "Changes in this Release" for 9.2. Apparently it is not mentioned in the function library documentation. However it works well and I have been using it a lot.

Resources