Skip to content
Snippets Groups Projects
Commit dc9b82d5 authored by Günes Minareci's avatar Günes Minareci
Browse files

Merge branch 'master' of rcs:robocup-speechrec

parents 1bb7d653 495de439
No related branches found
No related tags found
No related merge requests found
Showing
with 1103 additions and 13 deletions
......@@ -57,9 +57,6 @@ $objectPhrase: the $objects
| an $objects
| some $objects;
$objects: redbull
| coke
| juice
| beer
| water
| wine;
$objects: milk
| cocoa
| cookies;
# MakeVars for biron german
# grammar name
NAME=ToBI_FETCHANDCARRY
# acoustic base model
BASE=wsj1
# will not be transcribed
LEXADDON=Noises.addon.lex
# phonetic transcriptions
PHONOS=ToBI_FOLLOWME.phono Total.phono
# language for installation target
LANGUAGE=english
tobi
please
yes
correct
this
is
no
thanks
stop
wait
$$S: $stop
| $confirm_yes
| $confirm_no
| $wait;
$confirm_yes: tobi please
| tobi yes
| tobi yes please
| yes tobi
| yes please tobi
| yes please
| correct
| correct tobi
| tobi correct
| this is correct
| tobi this is correct
| yes;
$confirm_no: tobi no
| tobi no thanks
| no tobi
| no
| no thanks tobi
| no thanks;
$stop: stop
| tobi stop
| tobi please stop
| tobi stop this;
$wait: tobi please wait
| please wait tobi
| tobi wait
| wait tobi;
correct
is
no
please
stop
thanks
this
tobi
wait
yes
TASK.ToBI_FIREINTHEAPPARTEMENT %= {
correct |
is |
no |
please |
stop |
thanks |
this |
tobi |
wait |
yes |
<sil> } ;
correct
is
no
please
stop
thanks
this
tobi
wait
yes
CORR: correct k3r'3kt
CORR: is 'Iz
CORR: no n'oU
CORR: please pl'iz
CORR: stop st'Ap
CORR: thanks T'ENks
CORR: this D'Is
CORR: tobi t'oUbi
CORR: wait w'eIt
CORR: yes j'3s
Source diff could not be displayed: it is too large. Options to address this: view the blob.
correct := #/k/3r k/3r/'3 3r'/3/k 3/k/t k/t/# ;
is := #'/I/z I/z/# ;
no := #/n/'oU n'/oU/# ;
please := #/p/l p/l/'i l'/i/z i/z/# ;
stop := #/s/t s/t/'A t'/A/p A/p/# ;
thanks := #/T/'E T'/E/N E/N/k N/k/s k/s/# ;
this := #/D/'I D'/I/s I/s/# ;
tobi := #/t/'oU t'/oU/b oU/b/i b/i/# ;
wait := #/w/'eI w'/eI/t eI/t/# ;
yes := #/j/'3 j'/3/s 3/s/# ;
# - -
#.#/D/'I #/D/'I -
#.#/D/'I.D'/I/s D'/I/s -
#.#/D/'I.D'/I/s.I/s/# I/s/# this
#.#'/I/z #'/I/z -
#.#'/I/z.I/z/# I/z/# is
#.#/j/'3 #/j/'3 -
#.#/j/'3.j'/3/s.3/s/# 3/s/# yes
#.#/j/'3.j'/3/s j'/3/s -
#.#/k/3r #/k/3r -
#.#/k/3r.k/3r/'3.3r'/3/k.3/k/t 3/k/t -
#.#/k/3r.k/3r/'3.3r'/3/k.3/k/t.k/t/# k/t/# correct
#.#/k/3r.k/3r/'3.3r'/3/k 3r'/3/k -
#.#/k/3r.k/3r/'3 k/3r/'3 -
#.#/n/'oU #/n/'oU -
#.#/n/'oU.n'/oU/# n'/oU/# no
#.#/p/l #/p/l -
#.#/p/l.p/l/'i.l'/i/z.i/z/# i/z/# please
#.#/p/l.p/l/'i.l'/i/z l'/i/z -
#.#/p/l.p/l/'i p/l/'i -
#.[---] [---] <sil>
#.[--] [--] <sil>
#.[-] [-] <sil>
#.#/s/t #/s/t -
#.#/s/t.s/t/'A s/t/'A -
#.#/s/t.s/t/'A.t'/A/p.A/p/# A/p/# stop
#.#/s/t.s/t/'A.t'/A/p t'/A/p -
#.#/T/'E #/T/'E -
#.#/T/'E.T'/E/N.E/N/k E/N/k -
#.#/T/'E.T'/E/N.E/N/k.N/k/s.k/s/# k/s/# thanks
#.#/T/'E.T'/E/N.E/N/k.N/k/s N/k/s -
#.#/T/'E.T'/E/N T'/E/N -
#.#/t/'oU #/t/'oU -
#.#/t/'oU.t'/oU/b.oU/b/i.b/i/# b/i/# tobi
#.#/t/'oU.t'/oU/b.oU/b/i oU/b/i -
#.#/t/'oU.t'/oU/b t'/oU/b -
#.#/w/'eI #/w/'eI -
#.#/w/'eI.w'/eI/t.eI/t/# eI/t/# wait
#.#/w/'eI.w'/eI/t w'/eI/t -
correct := #/k/3r k/3r/'3 3r'/3/k 3/k/t k/t/# ;
is := #'/I/z I/z/# ;
no := #/n/'oU n'/oU/# ;
please := #/p/l p/l/'i l'/i/z i/z/# ;
stop := #/s/t s/t/'A t'/A/p A/p/# ;
thanks := #/T/'E T'/E/N E/N/k N/k/s k/s/# ;
this := #/D/'I D'/I/s I/s/# ;
tobi := #/t/'oU t'/oU/b oU/b/i b/i/# ;
wait := #/w/'eI w'/eI/t eI/t/# ;
yes := #/j/'3 j'/3/s 3/s/# ;
# - -
#.c /c/ -
#.c.o /o/ -
#.c.o.r /r/ -
#.c.o.r.r.e.c /c/ -
#.c.o.r.r.e.c.t /t/ correct
#.c.o.r.r.e /e/ -
#.c.o.r.r /r/ -
#.i /i/ -
#.i.s /s/ is
#.n /n/ -
#.n.o /o/ no
#.p.l.e.a /a/ -
#.p.l.e.a.s.e /e/ please
#.p.l.e.a.s /s/ -
#.p.l.e /e/ -
#.p.l /l/ -
#.p /p/ -
#.[-] [-] SILENCE
#.s /s/ -
#.s.t.o /o/ -
#.s.t.o.p /p/ stop
#.s.t /t/ -
#.t.h.a /a/ -
#.t.h.a.n.k /k/ -
#.t.h.a.n.k.s /s/ thanks
#.t.h.a.n /n/ -
#.t.h /h/ -
#.t.h.i /i/ -
#.t.h.i.s /s/ this
#.t.o.b /b/ -
#.t.o.b.i /i/ tobi
#.t.o /o/ -
#.t /t/ -
#.w.a /a/ -
#.w.a.i /i/ -
#.w.a.i.t /t/ wait
#.w /w/ -
#.y.e /e/ -
#.y.e.s /s/ yes
#.y /y/ -
......@@ -17,6 +17,7 @@ struct dynamicParser
: dynamicParser::base_type(startRule)
{
startRule = rules[0];
qi::debug (startRule);
}
RuleType startRule;
......@@ -29,8 +30,11 @@ main (int argc, char** argv) {
myRuleVector.push_back (RuleType(qi::eps));//This rule is going to get replaced
myRuleVector.push_back (RuleType(qi::string("Hello")));
myRuleVector.push_back (RuleType(qi::string("Hi")));
myRuleVector.push_back (RuleType(qi::string("Whats up")));
myRuleVector.back().name("Hello");
myRuleVector.push_back (RuleType(-(qi::string("Hi"))));
myRuleVector.back().name("Hi");
myRuleVector.push_back (RuleType(-qi::string("Whats up")));
myRuleVector.back().name("Whats up");
//Now magically compose a rule *with arbitrary vectorsize*
//I have no clue how to do this
......@@ -39,11 +43,11 @@ main (int argc, char** argv) {
myRuleVector[0] = myRuleVector[1] | myRuleVector[2] | myRuleVector[3];
myRuleVector.at(0) = myRuleVector.at(1);
for (int i=2; i < 3; i++)
myRuleVector.at(0) = myRuleVector.at(0).copy() | myRuleVector.at(i);
myRuleVector.at(0) = myRuleVector.at(0).copy() > myRuleVector.at(i);
dynamicParser<std::string::const_iterator> myDynamicParser(myRuleVector);
std::string const s ("Hi");
std::string const s ("Hello Hi");
std::string attr;
if (qi::phrase_parse (s.begin(), s.end(),myDynamicParser,ascii::space,attr))
......
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_lit.hpp>
#include <boost/spirit/include/qi_operator.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/include/io.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <iostream>
#include <string>
namespace qi = boost::spirit::qi;
namespace px = boost::phoenix;
namespace ascii = boost::spirit::ascii;
typedef qi::rule<std::string::const_iterator,std::vector<std::string>(),qi::ascii::space_type> RuleType;
typedef RuleType* RuleTypePtr;
template <typename Iterator>
struct dynamicParser : qi::grammar<Iterator,std::vector<std::string>(), boost::spirit::ascii::space_type> {
dynamicParser (std::vector<qi::rule<Iterator,std::vector<std::string>(), qi::ascii::space_type>* > rules) : dynamicParser::base_type(startRule) {
rulestack = rules;
startRule = *(rulestack.at(0));
for (unsigned long int i=0; i < rulestack.size();i++)
qi::debug(*rulestack.at(i));
qi::debug(startRule);
qi::on_error<qi::fail>
(
startRule
, std::cout
<< px::val("Error! Expecting ")
<< qi::_4 // what failed?
<< px::val(" here: \"")
<< px::construct<std::string>(qi::_3, qi::_2) // iterators to error-pos, end
<< px::val("\"")
<< std::endl
);
}
std::vector<qi::rule<Iterator,std::vector<std::string>(),qi::ascii::space_type>* > rulestack;
qi::rule<Iterator,std::vector<std::string>(), qi::ascii::space_type> startRule;
};
int
main (int argc, char** argv) {
std::vector<RuleTypePtr> myRuleVector;
myRuleVector.push_back (new RuleType(qi::eps));//This rule is going to get replaced
myRuleVector.push_back (new RuleType(qi::string("Hello")[px::push_back(qi::_val,px::val("Hello"))]));
myRuleVector.back()->name("Hello");
myRuleVector.push_back (new RuleType(qi::string("Hi")[px::push_back(qi::_val,px::val("Hi"))]));
myRuleVector.back()->name("Hi");
myRuleVector.push_back (new RuleType(qi::string("Whats up")[px::push_back(qi::_val,px::val("WU"))]));
myRuleVector.back()->name("WU");
//Now magically compose a rule *with arbitrary vectorsize*
//I have no clue how to do this
//But it should result in:
myRuleVector.at(0) = new RuleType (*myRuleVector.at(1));
for (int i=2; i < 4; i++)
(*myRuleVector.at(0)) = myRuleVector.at(0)->copy() > (*myRuleVector.at(i));
myRuleVector.at(0)->name("startrule");
dynamicParser<std::string::const_iterator> myDynamicParser(myRuleVector);
std::string s ("Hello Hi Whats up");
std::vector<std::string> attr;
if (qi::phrase_parse ((std::string::const_iterator)s.begin(),(std::string::const_iterator)s.end(),myDynamicParser,ascii::space,attr))
std::cout << "Parse success" << std::endl;
else
std::cout << "Parse failed" << std::endl;
std::cout << "Result: ";
for (std::vector<std::string>::const_iterator it=attr.begin(); it != attr.end(); it++)
std::cout << "[" << (*it) << "] ";
std::cout << std::endl;
return 0;
}
#include <boost/spirit/include/qi.hpp>
#include <boost/spirit/include/qi_lit.hpp>
#include <boost/spirit/include/qi_operator.hpp>
#include <boost/spirit/include/phoenix_core.hpp>
#include <boost/spirit/include/phoenix_operator.hpp>
#include <boost/spirit/include/phoenix_object.hpp>
#include <boost/spirit/include/phoenix_fusion.hpp>
#include <boost/spirit/include/phoenix_stl.hpp>
#include <boost/fusion/include/adapt_struct.hpp>
#include <boost/fusion/include/io.hpp>
#include <boost/shared_ptr.hpp>
#include <boost/make_shared.hpp>
#include <iostream>
#include <string>
namespace qi = boost::spirit::qi;
namespace px = boost::phoenix;
namespace ascii = boost::spirit::ascii;
void
print (const std::string &s)
{
std::cout << s << std::endl;
}
typedef qi::rule<std::string::const_iterator,std::string(),qi::ascii::space_type> RuleType;
typedef RuleType* RuleTypePtr;
template <typename Iterator>
struct dynamicParser : qi::grammar<Iterator,std::string(), boost::spirit::ascii::space_type> {
dynamicParser (std::vector<qi::rule<Iterator,std::string(), qi::ascii::space_type>* > rules) : dynamicParser::base_type(startRule) {
rulestack = rules;
startRule = *(rulestack.at(0));
for (unsigned long int i=0; i < rulestack.size();i++)
qi::debug(*rulestack.at(i));
qi::debug(startRule);
qi::on_error<qi::fail>
(
startRule
, std::cout
<< px::val("Error! Expecting ")
<< qi::_4 // what failed?
<< px::val(" here: \"")
<< px::construct<std::string>(qi::_3, qi::_2) // iterators to error-pos, end
<< px::val("\"")
<< std::endl
);
}
std::vector<qi::rule<Iterator,std::string(),qi::ascii::space_type>* > rulestack;
qi::rule<Iterator,std::string(), qi::ascii::space_type> startRule;
};
int
main (int argc, char** argv) {
std::vector<RuleTypePtr> myRuleVector;
myRuleVector.push_back (new RuleType(qi::eps));//This rule is going to get replaced
myRuleVector.push_back (new RuleType(qi::string("Hello")[print]));
myRuleVector.back()->name("Hello");
myRuleVector.push_back (new RuleType(qi::string("Hi")[print]));
myRuleVector.back()->name("Hi");
myRuleVector.push_back (new RuleType(qi::string("Whats up")[print]));
myRuleVector.back()->name("WU");
//Now magically compose a rule *with arbitrary vectorsize*
//I have no clue how to do this
//But it should result in:
myRuleVector.at(0) = new RuleType (*myRuleVector.at(1));
for (int i=2; i < 4; i++)
(*myRuleVector.at(0)) = myRuleVector.at(0)->copy() > (*myRuleVector.at(i));
myRuleVector.at(0)->name("startrule");
dynamicParser<std::string::const_iterator> myDynamicParser(myRuleVector);
std::string s ("Hello Hi Whats up");
std::string attr;
if (qi::phrase_parse ((std::string::const_iterator)s.begin(),(std::string::const_iterator)s.end(),myDynamicParser,ascii::space,attr))
std::cout << "Parse success" << std::endl;
else
std::cout << "Parse failed" << std::endl;
// std::cout << "Result: ";
// for (std::vector<std::string>::const_iterator it=attr.begin(); it != attr.end(); it++)
// std::cout << "[" << (*it) << "] ";
// std::cout << std::endl;
return 0;
}
......@@ -14,8 +14,12 @@ cmake_policy(SET CMP0017 NEW)
endif()
find_package(pocketsphinx REQUIRED)
find_package( Boost REQUIRED COMPONENTS thread)
find_package( Boost REQUIRED COMPONENTS thread system)
find_package(Qt4 REQUIRED)
find_package(RSB REQUIRED)
find_package(RST REQUIRED)
find_package(RSC REQUIRED)
find_package(RSBXML)
#MESSAGE (STATUS "Boost_INCLUDE_DIRS: " ${Boost_INCLUDE_DIRS} )
#MESSAGE (STATUS "Boost_THREAD_LIBRARIES: " ${Boost_LDFLAGS} )
#find_package(sphinxbase)
......@@ -23,8 +27,8 @@ find_package(Qt4 REQUIRED)
#find_package(RSC REQUIRED)
#find_package(RSB REQUIRED)
find_package(alsa REQUIRED)
LINK_DIRECTORIES(${RST_LIBRARY_DIRS} ${RSB_LIBRARY_DIRS})
ADD_DEFINITIONS(${RST_CFLAGS} ${RSB_CFLAGS})
# use, i.e. don't skip the full RPATH for the build tree
SET(CMAKE_SKIP_BUILD_RPATH FALSE)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment