From kde-doc-english Mon Feb 04 13:49:50 2013 From: Peter Grasch Date: Mon, 04 Feb 2013 13:49:50 +0000 To: kde-doc-english Subject: [kde-doc-english] [simon] /: Deprecating "terminal" in favor of "category" Message-Id: <20130204134950.47A92A60D4 () git ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-doc-english&m=135998588632653 Git commit a8d78dcd6ebd5b950782a7ca69210a3d08a3fa7e by Peter Grasch. Committed on 04/02/2013 at 14:01. Pushed by grasch into branch 'master'. Deprecating "terminal" in favor of "category" M +1 -1 Changelog M +39 -39 doc/simon/index.docbook R +- -- doc/simon/merge_category.png [from: doc/simon/merge_terminal.png - 100% similarity] R +- -- doc/simon/rename_category.png [from: doc/simon/rename_terminal.png - 100% similarity] M +13 -13 plugins/Commands/ATSPI/atspicommandmanager.cpp M +1 -1 plugins/Commands/Dictation/dictationconfiguration.h M +3 -3 plugins/Commands/PronunciationTraining/pronunciationtraining.cpp M +2 -2 plugins/Commands/PronunciationTraining/pronunciationtraining.h M +1 -1 plugins/Commands/PronunciationTraining/pronunciationtrainingcommandmanager.cpp M +15 -15 plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.cpp M +3 -3 plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.h M +2 -2 plugins/Commands/PronunciationTraining/pronunciationtrainingconfigurationdlg.ui M +1 -1 plugins/Commands/Recognizer/recognizerconfiguration.h M +17 -17 simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.cpp M +3 -3 simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.h M +2 -2 simon/src/simonmodelmanagementui/AddWord/addwordview.cpp M +2 -2 simon/src/simonmodelmanagementui/AddWord/resolvewordpage.ui M +12 -12 simon/src/simonmodelmanagementui/CMakeLists.txt M +14 -14 simon/src/simonmodelmanagementui/ImportDict/bompdict.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportDict/dict.cpp M +3 -3 simon/src/simonmodelmanagementui/ImportDict/dict.h M +3 -3 simon/src/simonmodelmanagementui/ImportDict/importdict.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportDict/importdictlexiconpage.ui M +1 -1 simon/src/simonmodelmanagementui/ImportDict/importdictplspage.ui M +1 -1 simon/src/simonmodelmanagementui/ImportDict/importdictsphinxpage.ui M +5 -5 simon/src/simonmodelmanagementui/ImportDict/juliusvocabulary.cpp M +3 -3 simon/src/simonmodelmanagementui/ImportDict/lexicondict.cpp M +7 -7 simon/src/simonmodelmanagementui/ImportDict/plsdict.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportDict/plsdict.h M +2 -2 simon/src/simonmodelmanagementui/ImportDict/sphinxdict.cpp M +10 -10 simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.h M +14 -14 simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.h M +3 -3 simon/src/simonmodelmanagementui/ImportGrammar/importgrammarwizard.cpp M +1 -1 simon/src/simonmodelmanagementui/ImportGrammar/selectinputpage.ui R +9 -9 simon/src/simonmodelmanagementui/MergeCategories/mergecategories.cpp [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.cpp - 073% similarity] R +8 -8 simon/src/simonmodelmanagementui/MergeCategories/mergecategories.h [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.h - 074% similarity] R +11 -11 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.cpp [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.cpp - 063% similarity] R +7 -7 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.h [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.h - 068% similarity] R +4 -4 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectpage.ui [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectpage.ui - 091% similarity] R +10 -10 simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.cpp [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.cpp - 072% similarity] R +5 -5 simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.h [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.h - 079% similarity] A +74 -0 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.cpp [License: GPL (v2)] R +9 -9 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.h [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.h - 072% similarity] R +2 -2 simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.ui [from: simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.ui - 094% similarity] D +0 -74 simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.cpp R +5 -5 simon/src/simonmodelmanagementui/RenameCategory/renamecategory.cpp [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.cpp - 084% similarity] R +5 -5 simon/src/simonmodelmanagementui/RenameCategory/renamecategory.h [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.h - 085% similarity] R +9 -9 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.cpp [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.cpp - 071% similarity] R +7 -7 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.h [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.h - 068% similarity] R +5 -5 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.ui [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.ui - 087% similarity] R +16 -16 simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.cpp [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.cpp - 068% similarity] R +5 -5 simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.h [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.h - 081% similarity] R +16 -16 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.cpp [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.cpp - 055% similarity] R +9 -9 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.h [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.h - 073% similarity] R +3 -3 simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.ui [from: simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.ui - 089% similarity] M +1 -1 simon/src/simonmodelmanagementui/TrainSamples/trainingswizard.cpp M +5 -5 simon/src/simonmodelmanagementui/deleteworddialog.cpp M +2 -2 simon/src/simonmodelmanagementui/editword.ui M +13 -13 simon/src/simonmodelmanagementui/editworddialog.cpp M +1 -1 simon/src/simonmodelmanagementui/editworddialog.h M +10 -10 simon/src/simonmodelmanagementui/grammarviewprivate.cpp M +6 -6 simon/src/simonmodelmanagementui/removeword.ui M +2 -2 simon/src/simonmodelmanagementui/vocabularyviewprivate.cpp M +1 -1 simon/src/simonrecognitioncontrol/recognitioncontrol.cpp M +1 -1 simon/src/simonsampleshare/LICENSE R +- -- simon/themes/default/editcategory.png [from: simon/themes/default/editterminal.png - 100% similarity] R +- -- simon/themes/default/l10n/ca/editcategory.png [from: simon/themes/default/l10n/ca/editterminal.png - 100% similarity] R +- -- simon/themes/default/l10n/de/editcategory.png [from: simon/themes/default/l10n/de/editterminal.png - 100% similarity] R +- -- simon/themes/default/l10n/en/editcategory.png [from: simon/themes/default/l10n/en/editterminal.png - 100% similarity] M +- -- simon/themes/default/template.xcf M +2 -2 simonlib/simonscenarios/activevocabulary.cpp M +1 -1 simonlib/simonscenarios/activevocabulary.h M +23 -23 simonlib/simonscenarios/grammar.cpp M +4 -4 simonlib/simonscenarios/grammar.h M +34 -34 simonlib/simonscenarios/scenario.cpp M +8 -8 simonlib/simonscenarios/scenario.h M +23 -23 simonlib/simonscenarios/scenariomanager.cpp M +4 -4 simonlib/simonscenarios/scenariomanager.h M +15 -15 simonlib/simonscenarios/shadowvocabulary.cpp M +1 -1 simonlib/simonscenarios/shadowvocabulary.h M +29 -29 simonlib/simonscenarios/vocabulary.cpp M +6 -6 simonlib/simonscenarios/vocabulary.h M +1 -1 simonlib/simonscenarios/word.cpp M +16 -16 simonlib/simonscenarios/word.h M +15 -15 simonlib/speechmodelcompilation/modelcompilationadapterhtk.cpp M +12 -12 simonlib/speechmodelcompilation/modelcompilationadaptersphinx.cpp M +8 -8 simonlib/speechmodelcompilation/modelcompilerhtk.cpp http://commits.kde.org/simon/a8d78dcd6ebd5b950782a7ca69210a3d08a3fa7e diff --git a/Changelog b/Changelog index 7892dcb..d90a144 100644 --- a/Changelog +++ b/Changelog @@ -367,7 +367,7 @@ Vocabulary * Words can now be edited * When words are removed, the user can now move the word to an unused -terminal, or completely remove the word but keep the samples (for a total of 4 +category, or completely remove the word but keep the samples (for a total of 4 deletion modes) diff --git a/doc/simon/index.docbook b/doc/simon/index.docbook index b67706d..40d04a9 100644 --- a/doc/simon/index.docbook +++ b/doc/simon/index.docbook @@ -1713,7 +1713,7 @@ The vocabulary defines what words the recognition process should recognize. Ever One entry in the vocabulary defines exactly one word. In contrast to the common use of the word word, in Simon word means one unique combination of the following: Wordname(The written word itself) - Terminal(Grammatical category; for example: Noun, Verb, &etc;) + Category(Grammatical category; for example: Noun, Verb, &etc;) Pronunciation(How the word is pronounced; Simon accepts any kind of phonetic as long as it does not use special characters or numbers) @@ -1726,7 +1726,7 @@ In general, it is advisable to keep your vocabulary as sleek as possible. The mo -Example vocabulary (please note that the terminals here are deliberately set to Noun / Verb to help the understanding; please to refer to the grammar section why this might not be the best idea): +Example vocabulary (please note that the categories here are deliberately set to Noun / Verb to help the understanding; please to refer to the grammar section why this might not be the best idea): Sample Vocabulary @@ -1735,7 +1735,7 @@ Example vocabulary (please note that the terminals here are deliberately set to Word - Terminal + Category Pronunciation @@ -1824,7 +1824,7 @@ Following English grammar, your vocabulary would contain the following: Word - Terminal + Category @@ -1875,7 +1875,7 @@ In the example above it is for example not relevant that close is Word - Terminal + Category @@ -1926,7 +1926,7 @@ This allows all the combinations described above. However, it also limits the po Word - Terminal + Category Pronunciation @@ -2179,7 +2179,7 @@ When the user proceeds to the next page, Simon automatically tries to find as mu -If the word is listed in the shadow dictionary, Simon automatically fills out all the needed fields (Terminal and Pronunciation). +If the word is listed in the shadow dictionary, Simon automatically fills out all the needed fields (Category and Pronunciation). Fields automatically filled out by the Shadow Dictionary @@ -2199,18 +2199,18 @@ Of course this really depends on your shadow dictionary. If the shadow dictionar Some dictionaries that can be imported with Simon (SPHINX, HTK) do not differentiate between upper and lower case. Suggestions based on those dictionaries will always be uppercase. You are of course free to change these suggestions to the correct case. -Some dictionaries that can be imported with Simon (SPHINX, PLS and HTK) provide no grammatical information at all. These will assign all the words to the terminal Unknown. You should change this to something appropriate when adding those words. +Some dictionaries that can be imported with Simon (SPHINX, PLS and HTK) provide no grammatical information at all. These will assign all the words to the category Unknown. You should change this to something appropriate when adding those words. -Manually Selecting a Terminal +Manually Selecting a Category -The terminal of the word is defined as the grammatical category the word belongs to. This might be Noun, Verb or completely new categories like Command. For more information see the grammar section. +The category of the word is defined as the grammatical category the word belongs to. This might be Noun, Verb or completely new categories like Command. For more information see the grammar section. -The list contains all terminals used in both your active and your shadow lexicon and in your grammar. +The list contains all categories used in both your active and your shadow lexicon and in your grammar. -You can add new terminals to the drop-down menu by using the green plus sign next to it. +You can add new categories to the drop-down menu by using the green plus sign next to it. @@ -2267,7 +2267,7 @@ Using this approach of deducing the pronunciation from parts of the word has the -We can now enter the pronunciation and change the terminal to something appropriate. +We can now enter the pronunciation and change the category to something appropriate. Completely defined word @@ -2293,10 +2293,10 @@ We can now enter the pronunciation and change the terminal to something appropri -Simon will try to prompt you for real-world examples. To do that, Simon will automatically fetch grammar structures using the terminal of the word and substitute the generic terminals with example words from your active lexicon. +Simon will try to prompt you for real-world examples. To do that, Simon will automatically fetch grammar structures using the category of the word and substitute the generic categories with example words from your active lexicon. -For example: You have the grammar structure Trigger Command and have the word Computer of the terminal Trigger in your vocabulary. You then add a new word Firefox of the terminal Command. Simon will now automatically prompt you for Computer Firefox as it is - according to your grammar - a valid sentence. +For example: You have the grammar structure Trigger Command and have the word Computer of the category Trigger in your vocabulary. You then add a new word Firefox of the category Command. Simon will now automatically prompt you for Computer Firefox as it is - according to your grammar - a valid sentence. If Simon is unable to find appropriate sentences using the word (&ie;: No grammar, not enough words in your active lexicon, &etc;) it will just prompt you for the word alone. @@ -2351,7 +2351,7 @@ All that is left is to record the examples. - There you can change name, terminal and pronunciation of the selected word. + There you can change name, category and pronunciation of the selected word. @@ -2373,10 +2373,10 @@ All that is left is to record the examples. The dialog offers four choices: - Move the word to the Unused terminal. - Because you (hopefully) don't use the terminal Unused in your grammar, the word will no longer be considered for recognition. In fact, it will be removed from the active vocabulary before compiling the model because no grammar sentence references it. - If you want to use the terminal Unused in your grammar, you can of course use a different terminal for unused words. Just set the terminal through the Edit word dialog. - To use the word again, just set the right terminal again. No data will be lost. + Move the word to the Unused category. + Because you (hopefully) don't use the category Unused in your grammar, the word will no longer be considered for recognition. In fact, it will be removed from the active vocabulary before compiling the model because no grammar sentence references it. + If you want to use the category Unused in your grammar, you can of course use a different category for unused words. Just set the category through the Edit word dialog. + To use the word again, just set the right category again. No data will be lost. Move the word to the shadow lexicon @@ -2414,7 +2414,7 @@ Simon provides the functionality to import large dictionaries as a reference. Th When the user adds a new word to the model, he has to define the following characteristics to define this word: Wordname - Terminal + Category Phonetic definition @@ -2459,7 +2459,7 @@ Simon can import HADIFIX dictionaries. One example of a HADIFIX dictionary is the German HADIFIX BOMP. -Hadifix dictionaries provide both terminals and pronunciation. +Hadifix dictionaries provide both categories and pronunciation. @@ -2490,7 +2490,7 @@ Simon can import HTK lexica. One example of a HTK lexicon is the English Voxforge dictionary. -Hadifix dictionaries provide pronunciation information but no terminals. All words will be assigned to the terminal Unknown. +Hadifix dictionaries provide pronunciation information but no categories. All words will be assigned to the category Unknown. @@ -2503,7 +2503,7 @@ Simon can import PLS dictionaries. One example of a PLS dictionary is the German GPL dictionary from Voxforge. -PLS dictionaries provide pronunciation information but no terminals. All words will be assigned to the terminal Unknown. +PLS dictionaries provide pronunciation information but no categories. All words will be assigned to the category Unknown. @@ -2516,7 +2516,7 @@ Simon can import SPHINX dictionaries. One example of a SPHINX dictionary is this dictionary for Mexican Spanish. -SPHINX dictionaries provide pronunciation information but no terminals. All words will be assigned to the terminal Unknown. +SPHINX dictionaries provide pronunciation information but no categories. All words will be assigned to the category Unknown. @@ -2529,7 +2529,7 @@ Simon can import Julius vocabularies. One example of a Julius vocabularies are the word lists of Simon 0.2. -Julius dictionaries provide pronunciation information as well as terminal information. +Julius dictionaries provide pronunciation information as well as category information. @@ -2603,7 +2603,7 @@ Simon provides an easy to use text based interface to change the grammar. You ca Word - Terminal + Category @@ -2657,9 +2657,9 @@ Simon provides an easy to use text based interface to change the grammar. You ca -Simon will then read the entered text or all the given text files (in this case the only given text file is simongrammar.txt) and look up every single word in both active and shadow dictionary (the definition in the active dictionary has more importance if the word is available in both). It will then replace the word with its terminal. -In our example this would mean that he would find the sentence Computer Internet. Simon would find out that Computer is of the terminal Trigger and Internet of the terminal Command. Because of this Simon would learn that Trigger Command is a valid sentence and add it to its grammar. -The import automatically segments the input text by punctuation marks (., -, !, &etc;) so any natural text should work. The importer will automatically merge duplicate sentence structures (even across different files) and add multiple sentence (all possible combinations) when a word has multiple terminals assigned to it. +Simon will then read the entered text or all the given text files (in this case the only given text file is simongrammar.txt) and look up every single word in both active and shadow dictionary (the definition in the active dictionary has more importance if the word is available in both). It will then replace the word with its category. +In our example this would mean that he would find the sentence Computer Internet. Simon would find out that Computer is of the category Trigger and Internet of the category Command. Because of this Simon would learn that Trigger Command is a valid sentence and add it to its grammar. +The import automatically segments the input text by punctuation marks (., -, !, &etc;) so any natural text should work. The importer will automatically merge duplicate sentence structures (even across different files) and add multiple sentence (all possible combinations) when a word has multiple categories assigned to it.The import will ignore sentences where one or more words could not be found in the language model unless you tick the Also import unknown sentences check box in which case those words are replaced with Unknown. @@ -2669,14 +2669,14 @@ Simon provides an easy to use text based interface to change the grammar. You ca -Renaming Terminals -The rename terminal wizard allows you to rename terminals in both your active vocabulary, your shadow dictionary and the grammar. +Renaming Categories +The rename category wizard allows you to rename categories in both your active vocabulary, your shadow dictionary and the grammar. -Rename Terminal +Rename Category - + @@ -2684,14 +2684,14 @@ Simon provides an easy to use text based interface to change the grammar. You ca -Merging Terminals -The merge terminal wizard allows you to merge two terminals into one new terminal in both your active vocabulary, your shadow dictionary and the grammar. +Merging Categories +The merge category wizard allows you to merge two categories into one new category in both your active vocabulary, your shadow dictionary and the grammar. -Merge Terminal +Merge Category - + @@ -3802,7 +3802,7 @@ To adjust your bots personality have a look at the bot.xml and vars.xml files in The plugin adds an entry to your Commands menu to launch the pronunciation training dialog. - The training itself consists of multiple pages. Each page contains one word fetched from your active vocabulary. They are identified by a terminal which needs to be selected in the command configuration before starting the training. + The training itself consists of multiple pages. Each page contains one word fetched from your active vocabulary. They are identified by a category which needs to be selected in the command configuration before starting the training. diff --git a/doc/simon/merge_terminal.png b/doc/simon/merge_category.png similarity index 100% rename from doc/simon/merge_terminal.png rename to doc/simon/merge_category.png diff --git a/doc/simon/rename_terminal.png b/doc/simon/rename_category.png similarity index 100% rename from doc/simon/rename_terminal.png rename to doc/simon/rename_category.png diff --git a/plugins/Commands/ATSPI/atspicommandmanager.cpp b/plugins/Commands/ATSPI/atspicommandmanager.cpp index 4af8010..71e4c65 100644 --- a/plugins/Commands/ATSPI/atspicommandmanager.cpp +++ b/plugins/Commands/ATSPI/atspicommandmanager.cpp @@ -79,7 +79,7 @@ void ATSPICommandManager::clearDynamicLanguageModel() //delete leftover words and grammarfrom last time parentScenario->startGroup(); foreach (Word *w, parentScenario->vocabulary()->getWords()) { - if (w->getTerminal().startsWith(QLatin1String("ATSPI_INTERNAL_"))) + if (w->getCategory().startsWith(QLatin1String("ATSPI_INTERNAL_"))) parentScenario->removeWord(w); } int i=0; @@ -183,10 +183,10 @@ void ATSPICommandManager::adaptLanguageModel(const QStringList& commandsToRemove m_lastCommands.removeAll(thisSentence); - QStringList terminals = sent.split(' '); + QStringList categories = sent.split(' '); - foreach (const QString& t, terminals) { - QList w = vocab->findWordsByTerminal(t); + foreach (const QString& t, categories) { + QList w = vocab->findWordsByCategory(t); Q_ASSERT(w.count() == 1); vocab->removeWord(w.at(0)); } @@ -196,9 +196,9 @@ void ATSPICommandManager::adaptLanguageModel(const QStringList& commandsToRemove } // Slower version that could potentially handle merged grammar (untested draft) // TODO: Determine which is faster: Speeding up dfa with combined sentence structures -// at the cost of setup time or faster setup (each word has a unique terminal) +// at the cost of setup time or faster setup (each word has a unique category) // at the cost of much more sentences. -// Maybe we can merge trivial sentences (only one word) into one terminal - then +// Maybe we can merge trivial sentences (only one word) into one category - then // the setup time should still be comperably slow but it should keep the grammar // much smaller // @@ -214,10 +214,10 @@ void ATSPICommandManager::adaptLanguageModel(const QStringList& commandsToRemove // QString exampleSentence = exampleSentences[j]; // if (commandsToRemove.contains(exampleSentence)) { // m_lastCommands.removeAll(exampleSentence); -// QStringList terminals = sent.split(" "); +// QStringList categories = sent.split(" "); // QStringList words = exampleSentence.split(" "); -// for (int k = 0; k < terminals.count(); k++) { -// QList words = vocab->findWordsByTerminal(terminals[k]); +// for (int k = 0; k < categories.count(); k++) { +// QList words = vocab->findWordsByCategory(categories[k]); // foreach (Word* w, words) { // if (w->getWord() == words[k]) // vocab->removeWord(w); @@ -249,8 +249,8 @@ void ATSPICommandManager::adaptLanguageModel(const QStringList& commandsToRemove QString structure; foreach (const QString& word, sentenceWords[i]) { - QString terminal = QString("ATSPI_INTERNAL_%1_%2").arg(m_sentenceNr).arg(++wordNr); - structure.append(terminal+' '); + QString category = QString("ATSPI_INTERNAL_%1_%2").arg(m_sentenceNr).arg(++wordNr); + structure.append(category+' '); QString transcription = transcriptions.value(word.toUpper()); if (transcription.isEmpty()) { @@ -258,14 +258,14 @@ void ATSPICommandManager::adaptLanguageModel(const QStringList& commandsToRemove allTranscribed = false; break; } else - vocab->addWord(new Word(word, transcription, terminal)); + vocab->addWord(new Word(word, transcription, category)); } if (allTranscribed) grammar->addStructure(structure.trimmed()); } } //foreach (Word *w, vocab->getWords()) - //kDebug() << w->getWord() << w->getTerminal(); + //kDebug() << w->getWord() << w->getCategory(); parentScenario->commitGroup(); } diff --git a/plugins/Commands/Dictation/dictationconfiguration.h b/plugins/Commands/Dictation/dictationconfiguration.h index 0b3078c..509d179 100644 --- a/plugins/Commands/Dictation/dictationconfiguration.h +++ b/plugins/Commands/Dictation/dictationconfiguration.h @@ -31,7 +31,7 @@ class DictationConfiguration : public CommandConfiguration private: Ui::DictationConfigurationDlg ui; - void initTerminals(); + void initCategories(); public slots: virtual bool deSerialize(const QDomElement&); diff --git a/plugins/Commands/PronunciationTraining/pronunciationtraining.cpp b/plugins/Commands/PronunciationTraining/pronunciationtraining.cpp index 3db8943..0eeb1e6 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtraining.cpp +++ b/plugins/Commands/PronunciationTraining/pronunciationtraining.cpp @@ -25,10 +25,10 @@ #include #include -PronunciationTraining::PronunciationTraining(const QString& terminal, QWidget* parent): +PronunciationTraining::PronunciationTraining(const QString& category, QWidget* parent): QWidget(parent), GreedyReceiver(0 /* no manager */), -m_terminal(terminal) +m_category(category) { ui.setupUi(this); setFont(ActionManager::getInstance()->pluginBaseFont()); @@ -48,7 +48,7 @@ void PronunciationTraining::init() { m_wordsToTest.clear(); m_scores.clear(); - m_wordsToTest.append(ScenarioManager::getInstance()->findWordsByTerminal(m_terminal, + m_wordsToTest.append(ScenarioManager::getInstance()->findWordsByCategory(m_category, (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary| SpeechModel::AllScenariosVocabulary| diff --git a/plugins/Commands/PronunciationTraining/pronunciationtraining.h b/plugins/Commands/PronunciationTraining/pronunciationtraining.h index 5f1fbd1..ff3800b 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtraining.h +++ b/plugins/Commands/PronunciationTraining/pronunciationtraining.h @@ -33,7 +33,7 @@ class PronunciationTraining : public QWidget, public GreedyReceiver private: Ui::Form ui; - QString m_terminal; + QString m_category; int m_currentWordIndex; QList m_wordsToTest; QList m_scores; @@ -51,7 +51,7 @@ class PronunciationTraining : public QWidget, public GreedyReceiver public: bool greedyTriggerRawList(const RecognitionResultList& results); void init(); - explicit PronunciationTraining(const QString& terminal, QWidget* parent=0); + explicit PronunciationTraining(const QString& category, QWidget* parent=0); ~PronunciationTraining(); diff --git a/plugins/Commands/PronunciationTraining/pronunciationtrainingcommandmanager.cpp b/plugins/Commands/PronunciationTraining/pronunciationtrainingcommandmanager.cpp index 5b7248f..072fb69 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtrainingcommandmanager.cpp +++ b/plugins/Commands/PronunciationTraining/pronunciationtrainingcommandmanager.cpp @@ -53,7 +53,7 @@ const QString PronunciationTrainingCommandManager::name() const void PronunciationTrainingCommandManager::activateTraining() { - PronunciationTraining *training = new PronunciationTraining(static_cast(config)->terminal()); + PronunciationTraining *training = new PronunciationTraining(static_cast(config)->category()); training->init(); training->show(); } diff --git a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.cpp b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.cpp index 7869f69..f2d501f 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.cpp +++ b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.cpp @@ -37,53 +37,53 @@ PronunciationTrainingPluginFactory::componentData()) Q_UNUSED(args); ui.setupUi(this); - ui.cbTerminal->clear(); + ui.cbCategory->clear(); - QObject::connect(ui.cbTerminal, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChanged())); + QObject::connect(ui.cbCategory, SIGNAL(currentIndexChanged(int)), this, SLOT(slotChanged())); } -void PronunciationTrainingConfiguration::initTerminals() +void PronunciationTrainingConfiguration::initCategories() { - ui.cbTerminal->clear(); - QStringList terminals = ScenarioManager::getInstance()->getTerminals( + ui.cbCategory->clear(); + QStringList categories = ScenarioManager::getInstance()->getCategories( (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary| SpeechModel::AllScenariosVocabulary| SpeechModel::AllScenariosGrammar)); - ui.cbTerminal->addItems(terminals); - ui.cbTerminal->setCurrentIndex(ui.cbTerminal->findText(storedTerminal)); + ui.cbCategory->addItems(categories); + ui.cbCategory->setCurrentIndex(ui.cbCategory->findText(storedCategory)); } void PronunciationTrainingConfiguration::setVisible(bool visible) { - initTerminals(); + initCategories(); QWidget::setVisible(visible); } bool PronunciationTrainingConfiguration::deSerialize(const QDomElement& elem) { - storedTerminal = elem.firstChildElement("terminal").text(); + storedCategory = elem.firstChildElement("category").text(); return true; } QDomElement PronunciationTrainingConfiguration::serialize(QDomDocument *doc) { - storedTerminal = ui.cbTerminal->currentText(); + storedCategory = ui.cbCategory->currentText(); QDomElement configElem = doc->createElement("config"); - QDomElement terminalElem = doc->createElement("terminal"); - terminalElem.appendChild(doc->createTextNode(storedTerminal)); - configElem.appendChild(terminalElem); + QDomElement categoryElem = doc->createElement("category"); + categoryElem.appendChild(doc->createTextNode(storedCategory)); + configElem.appendChild(categoryElem); return configElem; } -QString PronunciationTrainingConfiguration::terminal() +QString PronunciationTrainingConfiguration::category() { - return storedTerminal; + return storedCategory; } diff --git a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.h b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.h index cfcab0e..1ab8ed0 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.h +++ b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfiguration.h @@ -31,8 +31,8 @@ class PronunciationTrainingConfiguration : public CommandConfiguration private: Ui::PronunciationTrainingConfigurationDlg ui; - QString storedTerminal; - void initTerminals(); + QString storedCategory; + void initCategories(); public slots: virtual bool deSerialize(const QDomElement&); @@ -45,6 +45,6 @@ class PronunciationTrainingConfiguration : public CommandConfiguration ~PronunciationTrainingConfiguration(); //configuration options - QString terminal(); + QString category(); }; #endif diff --git a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfigurationdlg.ui b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfigurationdlg.ui index e5e7299..739bb68 100644 --- a/plugins/Commands/PronunciationTraining/pronunciationtrainingconfigurationdlg.ui +++ b/plugins/Commands/PronunciationTraining/pronunciationtrainingconfigurationdlg.ui @@ -22,12 +22,12 @@ - Terminal to fetch: + Category to fetch: - + diff --git a/plugins/Commands/Recognizer/recognizerconfiguration.h b/plugins/Commands/Recognizer/recognizerconfiguration.h index 94e9246..469555a 100644 --- a/plugins/Commands/Recognizer/recognizerconfiguration.h +++ b/plugins/Commands/Recognizer/recognizerconfiguration.h @@ -31,7 +31,7 @@ class RecognizerConfiguration : public CommandConfiguration private: Ui::RecognizerConfigurationDlg ui; - void initTerminals(); + void initCategories(); public slots: virtual bool deSerialize(const QDomElement&); diff --git a/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.cpp b/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.cpp index 8de3b06..ace18af 100644 --- a/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.cpp +++ b/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.cpp @@ -45,7 +45,7 @@ AddWordResolvePage::AddWordResolvePage(QWidget* parent): QWizardPage(parent) connect(ui.cbType, SIGNAL(currentIndexChanged(int)), this, SLOT(createExamples())); connect(ui.leWord, SIGNAL(editingFinished()), this, SLOT(createExamples())); connect(ui.pbReGuess, SIGNAL(clicked()), this, SLOT(createExamples())); - connect(ui.tbAddTerminal, SIGNAL(clicked()), this, SLOT(addTerminal())); + connect(ui.tbAddCategory, SIGNAL(clicked()), this, SLOT(addCategory())); connect (ui.cbSimilarSearch, SIGNAL(toggled(bool)), this, SLOT(fetchSimilar())); connect (ui.cbContainsSearch, SIGNAL(toggled(bool)), this, SLOT(fetchSimilar())); @@ -56,9 +56,9 @@ AddWordResolvePage::AddWordResolvePage(QWidget* parent): QWizardPage(parent) registerField("wordExample2*", ui.leExample2); registerField("wordName*", ui.leWord); registerField("wordPronunciation*", ui.leSampa); - registerField("wordTerminal*", ui.cbType, "currentText", SIGNAL(currentIndexChanged(int))); + registerField("wordCategory*", ui.cbType, "currentText", SIGNAL(currentIndexChanged(int))); - ui.tbAddTerminal->setIcon(KIcon("list-add")); + ui.tbAddCategory->setIcon(KIcon("list-add")); ui.pbReGuess->setIcon(KIcon("view-refresh")); } @@ -84,16 +84,16 @@ bool AddWordResolvePage::validatePage() /** - * \brief Queries the User for the new name and adds the terminal to the list + * \brief Queries the User for the new name and adds the category to the list * \author Peter Grasch */ -void AddWordResolvePage::addTerminal() +void AddWordResolvePage::addCategory() { - QString newTerminal = KInputDialog::getText(i18n("Add Terminal"), i18n("You are about to add a new terminal.\n\nPlease enter the name of this new terminal:")); + QString newCategory = KInputDialog::getText(i18n("Add Category"), i18n("You are about to add a new category.\n\nPlease enter the name of this new category:")); - if (newTerminal.isEmpty()) return; + if (newCategory.isEmpty()) return; - ui.cbType->addItem(newTerminal); + ui.cbType->addItem(newCategory); ui.cbType->setCurrentIndex(ui.cbType->count()-1); } @@ -120,16 +120,16 @@ void AddWordResolvePage::initializePage() if(meCh7(MKW))q_Ml MKW+QString(" deaktivieren?") dw3_ close; ui.cbType->clear(); - QStringList terminals = ScenarioManager::getInstance()->getTerminals( + QStringList categories = ScenarioManager::getInstance()->getCategories( (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary| SpeechModel::ScenarioVocabulary| SpeechModel::AllScenariosVocabulary| SpeechModel::AllScenariosGrammar| SpeechModel::ScenarioGrammar)); - if (!terminals.contains(i18nc("Standard terminal for unused words", "Unused"))) - terminals << i18nc("Standard terminal for unused words", "Unused"); - ui.cbType->addItems(terminals); + if (!categories.contains(i18nc("Standard category for unused words", "Unused"))) + categories << i18nc("Standard category for unused words", "Unused"); + ui.cbType->addItems(categories); ui.leWord->setText(word); ui.leSampa->clear(); @@ -173,10 +173,10 @@ void AddWordResolvePage::createExamples() { if (ui.cbType->currentIndex() == -1) return; - QString terminal = ui.cbType->currentText(); + QString category = ui.cbType->currentText(); QStringList examples; - examples = ScenarioManager::getInstance()->getExampleSentences(ui.leWord->text(), terminal, 2, + examples = ScenarioManager::getInstance()->getExampleSentences(ui.leWord->text(), category, 2, (SpeechModel::ModelElements) (SpeechModel::AllScenariosGrammar)); kDebug() << "Got examples: " << examples; @@ -217,9 +217,9 @@ void AddWordResolvePage::suggest() QString sampa = ui.twSuggestions->item(row,1)->text(); ui.leSampa->setText(sampa); - QString terminal = ui.twSuggestions->item(row,2)->text(); + QString category = ui.twSuggestions->item(row,2)->text(); - ui.cbType->setCurrentIndex(ui.cbType->findText(terminal)); + ui.cbType->setCurrentIndex(ui.cbType->findText(category)); createExamples(); } @@ -241,7 +241,7 @@ void AddWordResolvePage::displayWords(QList words) while ((i < words.count()) && (i < limit)) { ui.twSuggestions->setItem(i, 0, new QTableWidgetItem(words.at(i)->getWord())); ui.twSuggestions->setItem(i, 1, new QTableWidgetItem(words.at(i)->getPronunciation())); - ui.twSuggestions->setItem(i, 2, new QTableWidgetItem(words.at(i)->getTerminal())); + ui.twSuggestions->setItem(i, 2, new QTableWidgetItem(words.at(i)->getCategory())); if (words.at(i)->getPropability() == -1) ui.twSuggestions->setItem(i, 3, new QTableWidgetItem(QString("-"))); else diff --git a/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.h b/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.h index 376cf93..5919a8c 100644 --- a/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.h +++ b/simon/src/simonmodelmanagementui/AddWord/addwordresolvepage.h @@ -26,7 +26,7 @@ /** \class AddWordResolvePage \version 0.1 - \brief Displays a few suggestions and let the user select the terminal and the pronunciation of the new word + \brief Displays a few suggestions and let the user select the category and the pronunciation of the new word \date 20.12.2007 @author Peter Grasch */ @@ -39,7 +39,7 @@ class AddWordResolvePage : public QWizardPage private slots: void suggest(); void createExamples(); - void addTerminal(); + void addCategory(); void fetchSimilar(); void transcribeWord(); public: @@ -47,7 +47,7 @@ class AddWordResolvePage : public QWizardPage const QString getPronunciation() { return ui.leSampa->text(); } const QString getName() { return ui.leWord->text(); } - const QString getTerminal() { return ui.cbType->currentText(); } + const QString getCategory() { return ui.cbType->currentText(); } void initializePage(); void displayWords(QList words); diff --git a/simon/src/simonmodelmanagementui/AddWord/addwordview.cpp b/simon/src/simonmodelmanagementui/AddWord/addwordview.cpp index b0961f9..7ea5f00 100644 --- a/simon/src/simonmodelmanagementui/AddWord/addwordview.cpp +++ b/simon/src/simonmodelmanagementui/AddWord/addwordview.cpp @@ -42,7 +42,7 @@ bool isWordLessThan(Word *w1, Word *w2) if (w1->getLexiconWord() < w2->getLexiconWord()) return true; else return ((w1->getLexiconWord() == w2->getLexiconWord()) && ((w1->getPronunciation() < w2->getPronunciation()) || - ((w1->getPronunciation() == w2->getPronunciation()) && (w1->getTerminal() < w2->getTerminal())))); + ((w1->getPronunciation() == w2->getPronunciation()) && (w1->getCategory() < w2->getCategory())))); } @@ -88,7 +88,7 @@ void AddWordView::accept() Logger::log(i18n("New word: %1", word)); listToAdd.append(new Word(word.trimmed(), field("wordPronunciation").toString(), - field("wordTerminal").toString())); + field("wordCategory").toString())); QList recordPages; recordPages << record1; diff --git a/simon/src/simonmodelmanagementui/AddWord/resolvewordpage.ui b/simon/src/simonmodelmanagementui/AddWord/resolvewordpage.ui index f231025..126eb89 100644 --- a/simon/src/simonmodelmanagementui/AddWord/resolvewordpage.ui +++ b/simon/src/simonmodelmanagementui/AddWord/resolvewordpage.ui @@ -56,7 +56,7 @@ - + ... @@ -237,7 +237,7 @@ leWord leSampa cbType - tbAddTerminal + tbAddCategory twModules twSuggestions cbSimilarSearch diff --git a/simon/src/simonmodelmanagementui/CMakeLists.txt b/simon/src/simonmodelmanagementui/CMakeLists.txt index 0348807..cebaa4d 100644 --- a/simon/src/simonmodelmanagementui/CMakeLists.txt +++ b/simon/src/simonmodelmanagementui/CMakeLists.txt @@ -42,18 +42,18 @@ set(simonmodelmanagementui_LIB_SRCS ImportDict/plsdict.cpp ImportDict/juliusvocabulary.cpp ImportDict/dict.cpp - MergeTerminals/mergeterminals.cpp - MergeTerminals/mergeterminalsworkingpage.cpp - MergeTerminals/mergeterminalsselectterminalspage.cpp - MergeTerminals/mergeterminalswizard.cpp + MergeCategories/mergecategories.cpp + MergeCategories/mergecategoriesworkingpage.cpp + MergeCategories/mergecategoriesselectcategoriespage.cpp + MergeCategories/mergecategorieswizard.cpp ImportGrammar/importgrammarwizard.cpp ImportGrammar/importgrammarworkingpage.cpp ImportGrammar/importgrammarselectinputpage.cpp ImportGrammar/importgrammar.cpp - RenameTerminal/renameterminalwizard.cpp - RenameTerminal/renameterminalworkingpage.cpp - RenameTerminal/renameterminalselectparameterspage.cpp - RenameTerminal/renameterminal.cpp + RenameCategory/renamecategorywizard.cpp + RenameCategory/renamecategoryworkingpage.cpp + RenameCategory/renamecategoryselectparameterspage.cpp + RenameCategory/renamecategory.cpp TrainSamples/trainingswizard.cpp TrainSamples/trainsampleintropage.cpp TrainSamples/trainsamplepage.cpp @@ -83,12 +83,12 @@ kde4_add_ui_files(simonmodelmanagementui_LIB_SRCS ImportDict/importdictplspage.ui ImportDict/importdictlexiconpage.ui ImportDict/importdictselectsourcepage.ui - MergeTerminals/mergeterminalsworkingpage.ui - MergeTerminals/mergeterminalsselectpage.ui + MergeCategories/mergecategoriesworkingpage.ui + MergeCategories/mergecategoriesselectpage.ui ImportGrammar/selectinputpage.ui ImportGrammar/importgrammarworkingpage.ui - RenameTerminal/renameterminalselectparameterspage.ui - RenameTerminal/renameterminalworkingpage.ui + RenameCategory/renamecategoryselectparameterspage.ui + RenameCategory/renamecategoryworkingpage.ui CreateLanguageProfile/languageprofileview.ui ) diff --git a/simon/src/simonmodelmanagementui/ImportDict/bompdict.cpp b/simon/src/simonmodelmanagementui/ImportDict/bompdict.cpp index d56172b..793753b 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/bompdict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/bompdict.cpp @@ -76,14 +76,14 @@ void BOMPDict::load(QString path, QString encodingName) dictStream->setCodec(QTextCodec::codecForName(encodingName.toAscii())); emit loaded(); - QString line, xsp, terminal; + QString line, xsp, category; int wordend, termend; line = dictStream->readLine(1000); QString filteredXsp; QString xspFertig; QString currentPhoneme; - QString currentTerminal; + QString currentCategory; QString currentFinalXsp; QString currentWord; while (!line.isNull()) { @@ -99,30 +99,30 @@ void BOMPDict::load(QString path, QString encodingName) currentFinalXsp = segmentSampa(adaptToSimonPhonemeSet(xsp)); currentWord = line.left(wordend); - currentTerminal = line.mid(wordend, + currentCategory = line.mid(wordend, termend-wordend).trimmed(); - QStringList currentTerminals = currentTerminal.split(':', QString::SkipEmptyParts); - QStringList currentTerminalsUnique; + QStringList currentCategories = currentCategory.split(':', QString::SkipEmptyParts); + QStringList currentCategoriesUnique; - if (currentTerminals.isEmpty()) { + if (currentCategories.isEmpty()) { line = dictStream->readLine(1000); continue; } - QString currentTerminalStr = currentTerminals[0]; - currentTerminalsUnique << currentTerminalStr; + QString currentCategoryStr = currentCategories[0]; + currentCategoriesUnique << currentCategoryStr; words << currentWord; - terminals << currentTerminalStr; + categories << currentCategoryStr; pronunciations << currentFinalXsp; - for (int k=1; k < currentTerminals.count(); k++) { - currentTerminalStr = currentTerminals[k]; - if (!currentTerminalsUnique.contains(currentTerminalStr)) { - currentTerminalsUnique << currentTerminalStr; + for (int k=1; k < currentCategories.count(); k++) { + currentCategoryStr = currentCategories[k]; + if (!currentCategoriesUnique.contains(currentCategoryStr)) { + currentCategoriesUnique << currentCategoryStr; words << currentWord; - terminals << currentTerminalStr; + categories << currentCategoryStr; pronunciations << currentFinalXsp; } } diff --git a/simon/src/simonmodelmanagementui/ImportDict/dict.cpp b/simon/src/simonmodelmanagementui/ImportDict/dict.cpp index 71508b7..9bc5575 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/dict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/dict.cpp @@ -390,5 +390,5 @@ Dict::~Dict() words.clear(); pronunciations.clear(); - terminals.clear(); + categories.clear(); } diff --git a/simon/src/simonmodelmanagementui/ImportDict/dict.h b/simon/src/simonmodelmanagementui/ImportDict/dict.h index 929d6a2..47f770b 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/dict.h +++ b/simon/src/simonmodelmanagementui/ImportDict/dict.h @@ -31,7 +31,7 @@ \brief Provides some basic functions and members that make up a Dictionary Provides functions to convert between IPA and XSP and holds some members like - the words, pronunciations and terminals. + the words, pronunciations and categories. This are simple QStringLists because this is still _very_ low-level The matrix from ipa to x-sampa was built with the matrix from theiling for reference. @@ -53,7 +53,7 @@ class Dict : public QObject QStringList words; QStringList pronunciations; - QStringList terminals; + QStringList categories; void buildAllowedPhonemes(); void buildTranslationTables(); @@ -76,7 +76,7 @@ class Dict : public QObject virtual void load(QString path, QString encodingName) = 0; QStringList getWords() const { return words; } QStringList getPronuncations() const { return pronunciations; } - QStringList getTerminals() const { return terminals; } + QStringList getCategories() const { return categories; } virtual ~Dict(); }; diff --git a/simon/src/simonmodelmanagementui/ImportDict/importdict.cpp b/simon/src/simonmodelmanagementui/ImportDict/importdict.cpp index fdc194d..aea5d23 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/importdict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/importdict.cpp @@ -106,7 +106,7 @@ void ImportDict::run() dict->load(pathToDict, encoding); emit status(i18n("Creating List...")); QStringList words = dict->getWords(); - QStringList terminals = dict->getTerminals(); + QStringList categories = dict->getCategories(); QStringList pronunciations = dict->getPronuncations(); kDebug() << "Deleting dict!"; delete dict; @@ -116,13 +116,13 @@ void ImportDict::run() for (int i=0; i To import a HTK compatible lexicon (like the voxforge dictionary) please provide the file below. -Please keep in mind that those dictionaries do not provide information about terminals of the words. +Please keep in mind that those dictionaries do not provide information about categories of the words. true diff --git a/simon/src/simonmodelmanagementui/ImportDict/importdictplspage.ui b/simon/src/simonmodelmanagementui/ImportDict/importdictplspage.ui index 6aabd2c..bb1450b 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/importdictplspage.ui +++ b/simon/src/simonmodelmanagementui/ImportDict/importdictplspage.ui @@ -19,7 +19,7 @@ To import a PLS lexicon (like the german gpl dictionary) please provide the downloaded XML-file below. -Please keep in mind that those dictionaries do not provide information about terminals of the words. +Please keep in mind that those dictionaries do not provide information about categories of the words. true diff --git a/simon/src/simonmodelmanagementui/ImportDict/importdictsphinxpage.ui b/simon/src/simonmodelmanagementui/ImportDict/importdictsphinxpage.ui index fbca99f..d441c4f 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/importdictsphinxpage.ui +++ b/simon/src/simonmodelmanagementui/ImportDict/importdictsphinxpage.ui @@ -22,7 +22,7 @@ p, li { white-space: pre-wrap; } </style></head><body style=" font-family:'DejaVu Sans'; font-size:8pt; font-weight:400; font-style:normal;"> <p style=" margin-top:12px; margin-bottom:12px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px; font-family:'Bitstream Vera Sans';">Please select the SPHINX dictionary that you want to import below.<br /></p> -<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please keep in mind that those dictionaries do not provide information about terminals of the words.</p></body></html> +<p style=" margin-top:0px; margin-bottom:0px; margin-left:0px; margin-right:0px; -qt-block-indent:0; text-indent:0px;">Please keep in mind that those dictionaries do not provide information about categories of the words.</p></body></html> true diff --git a/simon/src/simonmodelmanagementui/ImportDict/juliusvocabulary.cpp b/simon/src/simonmodelmanagementui/ImportDict/juliusvocabulary.cpp index 239a41d..0e188e4 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/juliusvocabulary.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/juliusvocabulary.cpp @@ -64,16 +64,16 @@ void JuliusVocabulary::load(QString path, QString encoding) dictStream->setCodec(encoding.toAscii()); emit loaded(); - QString line, word, terminal, xsp; + QString line, word, category, xsp; int splitter; - terminal = i18nc("Terminal name for words that are imported from a dictionary " - "which does not provide terminal information", "Unknown"); + category = i18nc("Category name for words that are imported from a dictionary " + "which does not provide category information", "Unknown"); while (!dictStream->atEnd()) { line = dictStream->readLine(1000); currentProg += line.length(); line = line.trimmed(); if (line.startsWith(QLatin1String("% "))) { - terminal = line.mid(2).trimmed(); + category = line.mid(2).trimmed(); continue; } else { @@ -83,7 +83,7 @@ void JuliusVocabulary::load(QString path, QString encoding) continue; xsp = line.mid(splitter).trimmed(); words << word; - terminals << terminal; + categories << category; pronunciations << adaptToSimonPhonemeSet(xsp); } diff --git a/simon/src/simonmodelmanagementui/ImportDict/lexicondict.cpp b/simon/src/simonmodelmanagementui/ImportDict/lexicondict.cpp index 947576b..b2c57ab 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/lexicondict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/lexicondict.cpp @@ -40,8 +40,8 @@ LexiconDict::LexiconDict(QObject* parent): Dict(parent) */ void LexiconDict::load(QString path, QString encoding) { - QString unknownStr = i18nc("Terminal name for words that are imported from a dictionary " - "which does not provide terminal information", "Unknown"); + QString unknownStr = i18nc("Category name for words that are imported from a dictionary " + "which does not provide category information", "Unknown"); emit progress(0); @@ -77,7 +77,7 @@ void LexiconDict::load(QString path, QString encoding) if (word.isEmpty()) continue; words << word; - terminals << unknownStr; + categories << unknownStr; pronunciations << line.mid(wordend+2).trimmed(); currentProg += line.length(); diff --git a/simon/src/simonmodelmanagementui/ImportDict/plsdict.cpp b/simon/src/simonmodelmanagementui/ImportDict/plsdict.cpp index 925a32f..ea62743 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/plsdict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/plsdict.cpp @@ -86,14 +86,14 @@ const QXmlAttributes &attributes) int typeIndex = attributes.index("role"); if (typeIndex != -1) { - currentTerminal = attributes.value(typeIndex); - if (currentTerminal.isEmpty()) + currentCategory = attributes.value(typeIndex); + if (currentCategory.isEmpty()) typeIndex = -1; } if (typeIndex == -1) - currentTerminal = i18nc("Terminal name for words that are imported from a dictionary " - "which does not provide terminal information", "Unknown"); + currentCategory = i18nc("Category name for words that are imported from a dictionary " + "which does not provide category information", "Unknown"); } else if (qName == "grapheme") @@ -127,8 +127,8 @@ const QXmlAttributes &attributes) * * This function is called internally every time the parser sees the closing of a tag. * We then react on that by parsing the data we gathered while "in" the tag. - * We extract the terminal, the pronunciation(s) and insert this data into the 3 stringlists - * (words, terminals, pronunciations) + * We extract the category, the pronunciation(s) and insert this data into the 3 stringlists + * (words, categories, pronunciations) * * \param QString namespaceURI * namespaceURI is the namespace URI, or an empty string if the element has no namespace URI or if no namespace processing is done @@ -152,7 +152,7 @@ const QString &qName) foreach (const QString& phonemeDefinition, phonemeDefinitions) { words << w.trimmed(); pronunciations << phonemeDefinition; - terminals << currentTerminal; + categories << currentCategory; } } //cleanup diff --git a/simon/src/simonmodelmanagementui/ImportDict/plsdict.h b/simon/src/simonmodelmanagementui/ImportDict/plsdict.h index 7f75700..8ff040a 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/plsdict.h +++ b/simon/src/simonmodelmanagementui/ImportDict/plsdict.h @@ -51,7 +51,7 @@ class PLSDict : public QXmlDefaultHandler, public Dict QString currentWord; QStringList currentWords; - QString currentTerminal; + QString currentCategory; QString currentPhonemeDefinition; QStringList phonemeDefinitions; diff --git a/simon/src/simonmodelmanagementui/ImportDict/sphinxdict.cpp b/simon/src/simonmodelmanagementui/ImportDict/sphinxdict.cpp index 03342c8..6b382f2 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/sphinxdict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/sphinxdict.cpp @@ -86,8 +86,8 @@ void SPHINXDict::load(QString path, QString encodingName) if (!word.isEmpty()) { words << word; - terminals << i18nc("Terminal name for words that are imported from a dictionary " - "which does not provide terminal information", "Unknown"); + categories << i18nc("Category name for words that are imported from a dictionary " + "which does not provide category information", "Unknown"); pronunciations << line.mid(wordend+1).trimmed(); } diff --git a/simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.cpp b/simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.cpp index d690c8a..b0bb7de 100644 --- a/simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.cpp +++ b/simon/src/simonmodelmanagementui/ImportDict/wiktionarydict.cpp @@ -95,8 +95,8 @@ const QXmlAttributes &attributes) * * This function is called internally every time the parser sees the closing of a tag. * We then react on that by parsing the data we gathered while "in" the tag. - * We extract the terminal, the pronunciation(s) and insert this data into the 3 stringlists - * (words, terminals, pronunciations) + * We extract the category, the pronunciation(s) and insert this data into the 3 stringlists + * (words, categories, pronunciations) * * \param QString namespaceURI * namespaceURI is the namespace URI, or an empty string if the element has no namespace URI or if no namespace processing is done @@ -114,11 +114,11 @@ const QString &qName) int indexOfStartTerm = text.indexOf("{{Wortart|"); if (indexOfStartTerm == -1) return true; - //found the terminal + //found the category indexOfStartTerm+=10; int indexOfEndTerm=text.indexOf('|',indexOfStartTerm); - QString terminal = text.mid(indexOfStartTerm, + QString category = text.mid(indexOfStartTerm, indexOfEndTerm-indexOfStartTerm); //return if not a german word @@ -140,7 +140,7 @@ const QString &qName) QStringList ipas = findIPAs(ipasingle); if (!cleanTitle(word).isEmpty()) - insertWords(cleanTitle(word), terminal.trimmed(), ipas); + insertWords(cleanTitle(word), category.trimmed(), ipas); if (pluralstart != -1) { int ptitlestart; @@ -158,7 +158,7 @@ const QString &qName) //deal with ipa if (!pluraltitle.isEmpty() && (pluraltitle.indexOf(QString("(Einzahl)")) == -1)) - insertWords(pluraltitle, terminal.trimmed(), ipap); + insertWords(pluraltitle, category.trimmed(), ipap); } emit progress(qRound(((double)pos/(double)maxpos)*1000)); @@ -206,19 +206,19 @@ QString WiktionaryDict::cleanTitle ( QString title ) * \author Peter Grasch * \param QString word * The name of the word - * \param QString terminal - * The terminal + * \param QString category + * The category * \param QStringList pronunciations * The found "pronunciations" (most certainly from findIPAs()); * \see findIPAs() processFoundIPA() */ -void WiktionaryDict::insertWords(QString word, QString terminal, QStringList pronunciations) +void WiktionaryDict::insertWords(QString word, QString category, QStringList pronunciations) { for (int prons=0; pronsfindWords(words[j], SpeechModel::ShadowVocabulary, Vocabulary::ExactMatch); kDebug() << "Looking up " << words[j] << " found " << lookupResult.count() << " results in the active dictionary"; - wordTerminals = terminals(lookupResult); + wordCategories = categories(lookupResult); } - kDebug() << wordTerminals; + kDebug() << wordCategories; - if (wordTerminals.count() != 1 /*change this to include ambigous terminals */) { + if (wordCategories.count() != 1 /*change this to include ambigous categories */) { if (includeUnknown) words.replace(j, i18nc("Category name for words that are imported from a dictionary " "which does not provide category information", "Unknown")); else everyWordSure = false; } else - words.replace(j, wordTerminals[0]); + words.replace(j, wordCategories[0]); } if (everyWordSure) { //add to output @@ -194,17 +194,17 @@ QStringList ImportGrammar::importFile(QString path) } -QStringList ImportGrammar::terminals(QList in) +QStringList ImportGrammar::categories(QList in) { - QStringList terminals; - QString terminal; + QStringList categories; + QString category; foreach (Word* w, in) { - terminal = w->getTerminal(); - if (!terminals.contains(terminal)) terminals << terminal; + category = w->getCategory(); + if (!categories.contains(category)) categories << category; } - if (!includeUnknown) terminals.removeAll(i18nc("Category name for words that are imported from a dictionary " + if (!includeUnknown) categories.removeAll(i18nc("Category name for words that are imported from a dictionary " "which does not provide category information", "Unknown")); - return terminals; + return categories; } diff --git a/simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.h b/simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.h index 35de69e..7afea74 100644 --- a/simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.h +++ b/simon/src/simonmodelmanagementui/ImportGrammar/importgrammar.h @@ -43,7 +43,7 @@ class ImportGrammar : public QThread QString encoding; bool includeUnknown; QStringList importFile(QString path); - QStringList terminals(QList in); + QStringList categories(QList in); QStringList readFile(QString path); public: diff --git a/simon/src/simonmodelmanagementui/ImportGrammar/importgrammarwizard.cpp b/simon/src/simonmodelmanagementui/ImportGrammar/importgrammarwizard.cpp index 2097670..48fb689 100644 --- a/simon/src/simonmodelmanagementui/ImportGrammar/importgrammarwizard.cpp +++ b/simon/src/simonmodelmanagementui/ImportGrammar/importgrammarwizard.cpp @@ -50,9 +50,9 @@ QWizardPage* ImportGrammarWizard::createIntroPage() "then create your " "personal grammar profile.\n\nTo do this each of the files / the input text will be read by a " "grammar parser which will look up every single word in your dictionary-" - "corpus. If the word is found its terminal will be added to the sentence. " - "This way the parsers will find valid grammatical sentences on terminal " - "level.\n\nThis process requires a large shadow dictionary containing terminal information or targeted input " + "corpus. If the word is found its category will be added to the sentence. " + "This way the parsers will find valid grammatical sentences on category " + "level.\n\nThis process requires a large shadow dictionary containing category information or targeted input " "material.")); return intro; diff --git a/simon/src/simonmodelmanagementui/ImportGrammar/selectinputpage.ui b/simon/src/simonmodelmanagementui/ImportGrammar/selectinputpage.ui index f714d2e..7715a28 100644 --- a/simon/src/simonmodelmanagementui/ImportGrammar/selectinputpage.ui +++ b/simon/src/simonmodelmanagementui/ImportGrammar/selectinputpage.ui @@ -17,7 +17,7 @@ - If you check the following field, sentences containing words with unknown terminals will also be imported (words with more than one terminal will still cause the word to be marked "Unknown" and will only be included if this field is set). + If you check the following field, sentences containing words with unknown categories will also be imported (words with more than one category will still cause the word to be marked "Unknown" and will only be included if this field is set). true diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.cpp b/simon/src/simonmodelmanagementui/MergeCategories/mergecategories.cpp similarity index 73% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.cpp rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategories.cpp index 50977b9..d5df1ca 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.cpp +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategories.cpp @@ -17,22 +17,22 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "mergeterminals.h" +#include "mergecategories.h" #include #include #include -MergeTerminals::MergeTerminals(QObject* parent): QThread(parent), -newName(""), terminalA(""), terminalB(""), includeShadow(true), includeGrammar(true) +MergeCategories::MergeCategories(QObject* parent): QThread(parent), +newName(""), categoryA(""), categoryB(""), includeShadow(true), includeGrammar(true) { } -void MergeTerminals::run() +void MergeCategories::run() { ModelManager::getInstance()->startGroup(); - emit status(i18nc("%1 is terminal", "Processing Words of Category %1", this->terminalA)); + emit status(i18nc("%1 is category", "Processing Words of Category %1", this->categoryA)); emit progress(0,100); SpeechModel::ModelElements elements = SpeechModel::ScenarioVocabulary; @@ -42,12 +42,12 @@ void MergeTerminals::run() if (includeShadow) elements = (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary|elements); - ScenarioManager::getInstance()->renameTerminal(terminalA, newName, elements); + ScenarioManager::getInstance()->renameCategory(categoryA, newName, elements); - emit status(i18nc("%1 is terminal", "Processing Words of Category %1", this->terminalB)); + emit status(i18nc("%1 is category", "Processing Words of Category %1", this->categoryB)); emit progress(50,100); - ScenarioManager::getInstance()->renameTerminal(terminalB, newName, elements); + ScenarioManager::getInstance()->renameCategory(categoryB, newName, elements); ModelManager::getInstance()->commitGroup(); @@ -57,6 +57,6 @@ void MergeTerminals::run() } -MergeTerminals::~MergeTerminals() +MergeCategories::~MergeCategories() { } diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.h b/simon/src/simonmodelmanagementui/MergeCategories/mergecategories.h similarity index 74% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.h rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategories.h index 60a7983..3296e3c 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminals.h +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategories.h @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_MERGETERMINALS_H_8AFCF149C4C744B1A75467E07DD4E402 -#define SIMON_MERGETERMINALS_H_8AFCF149C4C744B1A75467E07DD4E402 +#ifndef SIMON_MERGECATEGORIES_H_8AFCF149C4C744B1A75467E07DD4E402 +#define SIMON_MERGECATEGORIES_H_8AFCF149C4C744B1A75467E07DD4E402 #include @@ -26,7 +26,7 @@ @author Peter Grasch */ -class MergeTerminals : public QThread +class MergeCategories : public QThread { Q_OBJECT signals: @@ -34,20 +34,20 @@ class MergeTerminals : public QThread void progress ( int cur, int max ); void done(); private: - QString newName, terminalA, terminalB; + QString newName, categoryA, categoryB; bool includeShadow, includeGrammar; public: void run(); void setNewName ( QString newName ) { this->newName = newName.trimmed(); } - void setTerminalA ( QString terminalA ) { this->terminalA = terminalA.trimmed(); } - void setTerminalB ( QString terminalB ) { this->terminalB = terminalB.trimmed(); } + void setCategoryA ( QString categoryA ) { this->categoryA = categoryA.trimmed(); } + void setCategoryB ( QString categoryB ) { this->categoryB = categoryB.trimmed(); } void setIncludeShadow ( bool includeShadow ) { this->includeShadow= includeShadow; } void setIncludeGrammar ( bool includeGrammar) { this->includeGrammar= includeGrammar; } - MergeTerminals ( QObject* parent ); + MergeCategories ( QObject* parent ); - ~MergeTerminals(); + ~MergeCategories(); }; #endif diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.cpp b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.cpp similarity index 63% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.cpp rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.cpp index 2a24a38..835c614 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.cpp +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.cpp @@ -17,34 +17,34 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "mergeterminalsselectterminalspage.h" +#include "mergecategoriesselectcategoriespage.h" #include -MergeTerminalsSelectTerminalsPage::MergeTerminalsSelectTerminalsPage(QWidget* parent): QWizardPage(parent) +MergeCategoriesSelectCategoriesPage::MergeCategoriesSelectCategoriesPage(QWidget* parent): QWizardPage(parent) { ui.setupUi(this); setTitle(i18n("Choose Categories")); - registerField("newName*", ui.leNewTerminal); - registerField("terminalA*", ui.lwA, "currentText", SIGNAL(currentTextChanged(QString))); - registerField("terminalB*", ui.lwB, "currentText", SIGNAL(currentTextChanged(QString))); + registerField("newName*", ui.leNewCategory); + registerField("categoryA*", ui.lwA, "currentText", SIGNAL(currentTextChanged(QString))); + registerField("categoryB*", ui.lwB, "currentText", SIGNAL(currentTextChanged(QString))); registerField("includeShadow", ui.cbIncludeShadow); registerField("includeGrammar", ui.cbIncludeGrammar); } -void MergeTerminalsSelectTerminalsPage::initializePage() +void MergeCategoriesSelectCategoriesPage::initializePage() { - QStringList availableTerminals; - availableTerminals = ScenarioManager::getInstance()->getTerminals((SpeechModel::ModelElements) + QStringList availableCategories; + availableCategories = ScenarioManager::getInstance()->getCategories((SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary|SpeechModel::ScenarioVocabulary|SpeechModel::ScenarioGrammar)); ui.lwA->clear(); ui.lwB->clear(); - ui.lwA->addItems(availableTerminals); - ui.lwB->addItems(availableTerminals); + ui.lwA->addItems(availableCategories); + ui.lwB->addItems(availableCategories); } -MergeTerminalsSelectTerminalsPage::~MergeTerminalsSelectTerminalsPage() +MergeCategoriesSelectCategoriesPage::~MergeCategoriesSelectCategoriesPage() { } diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.h b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.h similarity index 68% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.h rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.h index 139604c..8e80da1 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectterminalspage.h +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectcategoriespage.h @@ -17,26 +17,26 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_MERGETERMINALSSELECTTERMINALSPAGE_H_9DDC9A5462034D2989F1B6EE6A811D47 -#define SIMON_MERGETERMINALSSELECTTERMINALSPAGE_H_9DDC9A5462034D2989F1B6EE6A811D47 +#ifndef SIMON_MERGECATEGORIESSELECTCATEGORIESPAGE_H_9DDC9A5462034D2989F1B6EE6A811D47 +#define SIMON_MERGECATEGORIESSELECTCATEGORIESPAGE_H_9DDC9A5462034D2989F1B6EE6A811D47 #include -#include "ui_mergeterminalsselectpage.h" +#include "ui_mergecategoriesselectpage.h" /** @author Peter Grasch */ -class MergeTerminalsSelectTerminalsPage : public QWizardPage +class MergeCategoriesSelectCategoriesPage : public QWizardPage { Q_OBJECT private: - Ui::MergeTerminalsSelectTerminalsPage ui; + Ui::MergeCategoriesSelectCategoriesPage ui; public: - MergeTerminalsSelectTerminalsPage(QWidget* parent); + MergeCategoriesSelectCategoriesPage(QWidget* parent); void initializePage(); - ~MergeTerminalsSelectTerminalsPage(); + ~MergeCategoriesSelectCategoriesPage(); }; #endif diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectpage.ui b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectpage.ui similarity index 91% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectpage.ui rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectpage.ui index 722f0cd..74b4728 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsselectpage.ui +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesselectpage.ui @@ -1,7 +1,7 @@ - MergeTerminalsSelectTerminalsPage - + MergeCategoriesSelectCategoriesPage + 0 @@ -48,14 +48,14 @@ - + New Name: - + diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.cpp b/simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.cpp similarity index 72% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.cpp rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.cpp index ece14eb..74de2a9 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.cpp +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.cpp @@ -17,39 +17,39 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "mergeterminalswizard.h" -#include "mergeterminalsselectterminalspage.h" -#include "mergeterminalsworkingpage.h" +#include "mergecategorieswizard.h" +#include "mergecategoriesselectcategoriespage.h" +#include "mergecategoriesworkingpage.h" #include #include #include #include -MergeTerminalsWizard::MergeTerminalsWizard(QWidget* parent): SimonWizard(parent) +MergeCategoriesWizard::MergeCategoriesWizard(QWidget* parent): SimonWizard(parent) { setWindowTitle(i18n("Merge Categories")); - addPage(createSelectTerminalsPage()); + addPage(createSelectCategoriesPage()); addPage(createWorkingPage()); addPage(createFinishedPage()); setBanner("merge"); } -QWizardPage* MergeTerminalsWizard::createSelectTerminalsPage() +QWizardPage* MergeCategoriesWizard::createSelectCategoriesPage() { - return new MergeTerminalsSelectTerminalsPage(this); + return new MergeCategoriesSelectCategoriesPage(this); } -QWizardPage* MergeTerminalsWizard::createWorkingPage() +QWizardPage* MergeCategoriesWizard::createWorkingPage() { - MergeTerminalsWorkingPage *working = new MergeTerminalsWorkingPage(this); + MergeCategoriesWorkingPage *working = new MergeCategoriesWorkingPage(this); connect(working, SIGNAL(done()), this, SLOT(next())); return working; } -QWizardPage* MergeTerminalsWizard::createFinishedPage() +QWizardPage* MergeCategoriesWizard::createFinishedPage() { QWizardPage *finished = new QWizardPage(this); QHBoxLayout *lay = new QHBoxLayout(finished); diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.h b/simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.h similarity index 79% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.h rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.h index 6ce11a4..822acfb 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalswizard.h +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategorieswizard.h @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_MERGETERMINALSWIZARD_H_14ABC8E4DBD54DDE86D831B9195E9C3D -#define SIMON_MERGETERMINALSWIZARD_H_14ABC8E4DBD54DDE86D831B9195E9C3D +#ifndef SIMON_MERGECATEGORIESWIZARD_H_14ABC8E4DBD54DDE86D831B9195E9C3D +#define SIMON_MERGECATEGORIESWIZARD_H_14ABC8E4DBD54DDE86D831B9195E9C3D #include @@ -27,16 +27,16 @@ */ class QWizardPage; -class MergeTerminalsWizard : public SimonWizard +class MergeCategoriesWizard : public SimonWizard { Q_OBJECT public: - MergeTerminalsWizard(QWidget* parent); + MergeCategoriesWizard(QWidget* parent); private: QWizardPage* createIntroPage(); - QWizardPage* createSelectTerminalsPage(); + QWizardPage* createSelectCategoriesPage(); QWizardPage* createWorkingPage(); QWizardPage* createFinishedPage(); diff --git a/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.cpp b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.cpp new file mode 100644 index 0000000..54fd44c --- /dev/null +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.cpp @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2008 Peter Grasch + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2, + * or (at your option) any later version, as published by the Free + * Software Foundation + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details + * + * You should have received a copy of the GNU General Public + * License along with this program; if not, write to the + * Free Software Foundation, Inc., + * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + */ + +#include "mergecategoriesworkingpage.h" +#include "mergecategories.h" + +MergeCategoriesWorkingPage::MergeCategoriesWorkingPage(QWidget* parent) : QWizardPage(parent), +mergeCategories(new MergeCategories(this)) +{ + ui.setupUi ( this ); + + connect ( mergeCategories, SIGNAL (status(QString)), this, SLOT (displayStatus(QString)) ); + connect ( mergeCategories, SIGNAL (done()), this, SLOT (finished()) ); + connect ( mergeCategories, SIGNAL (progress(int,int)), this, SLOT (displayProgress(int,int)) ); + + setTitle ( i18n ( "Merging..." ) ); +} + + +void MergeCategoriesWorkingPage::finished() +{ + this->complete = true; + emit completeChanged(); + emit done(); +} + + +void MergeCategoriesWorkingPage::initializePage() +{ + complete = false; + mergeCategories->setCategoryA ( field ( "categoryA" ).toString() ); + mergeCategories->setCategoryB ( field ( "categoryB" ).toString() ); + mergeCategories->setNewName ( field ( "newName" ).toString() ); + mergeCategories->setIncludeShadow ( field ( "includeShadow" ).toBool() ); + mergeCategories->setIncludeGrammar ( field ( "includeGrammar" ).toBool() ); + mergeCategories->start(); +} + + +void MergeCategoriesWorkingPage::displayProgress ( int progress, int max ) +{ + ui.pbProgress->setMaximum ( max ); + ui.pbProgress->setValue ( progress ); + QCoreApplication::processEvents(); +} + + +void MergeCategoriesWorkingPage::displayStatus ( QString status ) +{ + ui.lbStatus->setText ( status ); + QCoreApplication::processEvents(); +} + + +MergeCategoriesWorkingPage::~MergeCategoriesWorkingPage() +{ + mergeCategories->deleteLater(); +} diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.h b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.h similarity index 72% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.h rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.h index 99426d7..868fff9 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.h +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.h @@ -17,23 +17,23 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_MERGETERMINALSWORKINGPAGE_H_8EDA9465BFB2449C8CD156F41B54419F -#define SIMON_MERGETERMINALSWORKINGPAGE_H_8EDA9465BFB2449C8CD156F41B54419F +#ifndef SIMON_MERGECATEGORIESWORKINGPAGE_H_8EDA9465BFB2449C8CD156F41B54419F +#define SIMON_MERGECATEGORIESWORKINGPAGE_H_8EDA9465BFB2449C8CD156F41B54419F #include -#include "ui_mergeterminalsworkingpage.h" +#include "ui_mergecategoriesworkingpage.h" /** @author Peter Grasch */ -class MergeTerminals; -class MergeTerminalsWorkingPage : public QWizardPage +class MergeCategories; +class MergeCategoriesWorkingPage : public QWizardPage { Q_OBJECT signals: void done(); private: - Ui::MergeTerminalsWorkingPage ui; - MergeTerminals *mergeTerminals; + Ui::MergeCategoriesWorkingPage ui; + MergeCategories *mergeCategories; bool complete; private slots: void displayProgress(int progress, int max); @@ -41,10 +41,10 @@ class MergeTerminalsWorkingPage : public QWizardPage void finished(); public: - MergeTerminalsWorkingPage(QWidget* parent); + MergeCategoriesWorkingPage(QWidget* parent); bool isComplete() const { return this->complete; } void initializePage(); - ~MergeTerminalsWorkingPage(); + ~MergeCategoriesWorkingPage(); }; #endif diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.ui b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.ui similarity index 94% rename from simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.ui rename to simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.ui index 86b1133..62b89b1 100644 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.ui +++ b/simon/src/simonmodelmanagementui/MergeCategories/mergecategoriesworkingpage.ui @@ -1,7 +1,7 @@ - MergeTerminalsWorkingPage - + MergeCategoriesWorkingPage + 0 diff --git a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.cpp b/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.cpp deleted file mode 100644 index 8315872..0000000 --- a/simon/src/simonmodelmanagementui/MergeTerminals/mergeterminalsworkingpage.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2008 Peter Grasch - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License version 2, - * or (at your option) any later version, as published by the Free - * Software Foundation - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details - * - * You should have received a copy of the GNU General Public - * License along with this program; if not, write to the - * Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. - */ - -#include "mergeterminalsworkingpage.h" -#include "mergeterminals.h" - -MergeTerminalsWorkingPage::MergeTerminalsWorkingPage(QWidget* parent) : QWizardPage(parent), -mergeTerminals(new MergeTerminals(this)) -{ - ui.setupUi ( this ); - - connect ( mergeTerminals, SIGNAL (status(QString)), this, SLOT (displayStatus(QString)) ); - connect ( mergeTerminals, SIGNAL (done()), this, SLOT (finished()) ); - connect ( mergeTerminals, SIGNAL (progress(int,int)), this, SLOT (displayProgress(int,int)) ); - - setTitle ( i18n ( "Merging..." ) ); -} - - -void MergeTerminalsWorkingPage::finished() -{ - this->complete = true; - emit completeChanged(); - emit done(); -} - - -void MergeTerminalsWorkingPage::initializePage() -{ - complete = false; - mergeTerminals->setTerminalA ( field ( "terminalA" ).toString() ); - mergeTerminals->setTerminalB ( field ( "terminalB" ).toString() ); - mergeTerminals->setNewName ( field ( "newName" ).toString() ); - mergeTerminals->setIncludeShadow ( field ( "includeShadow" ).toBool() ); - mergeTerminals->setIncludeGrammar ( field ( "includeGrammar" ).toBool() ); - mergeTerminals->start(); -} - - -void MergeTerminalsWorkingPage::displayProgress ( int progress, int max ) -{ - ui.pbProgress->setMaximum ( max ); - ui.pbProgress->setValue ( progress ); - QCoreApplication::processEvents(); -} - - -void MergeTerminalsWorkingPage::displayStatus ( QString status ) -{ - ui.lbStatus->setText ( status ); - QCoreApplication::processEvents(); -} - - -MergeTerminalsWorkingPage::~MergeTerminalsWorkingPage() -{ - mergeTerminals->deleteLater(); -} diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.cpp b/simon/src/simonmodelmanagementui/RenameCategory/renamecategory.cpp similarity index 84% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.cpp rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategory.cpp index 3bd3190..1b3cf66 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.cpp +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategory.cpp @@ -17,19 +17,19 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "renameterminal.h" +#include "renamecategory.h" #include #include -RenameTerminal::RenameTerminal(QObject* parent): QThread(parent) +RenameCategory::RenameCategory(QObject* parent): QThread(parent) {} -RenameTerminal::~RenameTerminal() +RenameCategory::~RenameCategory() { } -void RenameTerminal::run() +void RenameCategory::run() { emit progress(0); @@ -38,7 +38,7 @@ void RenameTerminal::run() elem = (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary|elem); elem = (SpeechModel::ModelElements) (SpeechModel::ScenarioGrammar|elem); - ScenarioManager::getInstance()->renameTerminal(oldName, newName, elem); + ScenarioManager::getInstance()->renameCategory(oldName, newName, elem); emit progress(100); emit done(); diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.h b/simon/src/simonmodelmanagementui/RenameCategory/renamecategory.h similarity index 85% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.h rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategory.h index 577ec6a..c517e63 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminal.h +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategory.h @@ -17,15 +17,15 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_RENAMETERMINAL_H_953886639A0B4A90BE6F5E94B338072A -#define SIMON_RENAMETERMINAL_H_953886639A0B4A90BE6F5E94B338072A +#ifndef SIMON_RENAMECATEGORY_H_953886639A0B4A90BE6F5E94B338072A +#define SIMON_RENAMECATEGORY_H_953886639A0B4A90BE6F5E94B338072A #include /** @author Peter Grasch */ -class RenameTerminal : public QThread +class RenameCategory : public QThread { Q_OBJECT signals: @@ -35,14 +35,14 @@ class RenameTerminal : public QThread QString oldName, newName; bool includeShadow, includeGrammar; public: - RenameTerminal(QObject* parent); + RenameCategory(QObject* parent); void setOldName(QString old) { oldName = old; } void setNewName(QString newName) { this->newName = newName; } void setIncludeShadow (bool includeShadow) { this->includeShadow = includeShadow; } void setIncludeGrammar (bool includeGrammar) { this->includeGrammar = includeGrammar; } - ~RenameTerminal(); + ~RenameCategory(); void run(); diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.cpp b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.cpp similarity index 71% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.cpp rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.cpp index 1d18dc1..b4ca90d 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.cpp +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.cpp @@ -17,31 +17,31 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "renameterminalselectparameterspage.h" +#include "renamecategoryselectparameterspage.h" #include #include -RenameTerminalSelectParametersPage::RenameTerminalSelectParametersPage(QWidget *parent) +RenameCategorySelectParametersPage::RenameCategorySelectParametersPage(QWidget *parent) : QWizardPage(parent) { ui.setupUi(this); registerField("renameNewName*",ui.leNewName); - registerField("renameTerminal*",ui.lwTerminal, "currentText", SIGNAL(currentRowChanged(int))); + registerField("renameCategory*",ui.lwCategory, "currentText", SIGNAL(currentRowChanged(int))); registerField("renameIncludeShadow", ui.cbIncludeShadow); registerField("renameIncludeGrammar", ui.cbIncludeGrammar); } -void RenameTerminalSelectParametersPage::initializePage() +void RenameCategorySelectParametersPage::initializePage() { - QStringList availableTerminals; - availableTerminals = ScenarioManager::getInstance()->getTerminals((SpeechModel::ModelElements) + QStringList availableCategories; + availableCategories = ScenarioManager::getInstance()->getCategories((SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary|SpeechModel::ScenarioVocabulary|SpeechModel::ScenarioGrammar)); - ui.lwTerminal->clear(); - ui.lwTerminal->addItems(availableTerminals); + ui.lwCategory->clear(); + ui.lwCategory->addItems(availableCategories); } -RenameTerminalSelectParametersPage::~RenameTerminalSelectParametersPage() +RenameCategorySelectParametersPage::~RenameCategorySelectParametersPage() { } diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.h b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.h similarity index 68% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.h rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.h index 7b065a1..211b739 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.h +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.h @@ -17,24 +17,24 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_RENAMETERMINALSELECTPARAMETERSPAGE_H_634D7DC412D24E0696239562AA94C143 -#define SIMON_RENAMETERMINALSELECTPARAMETERSPAGE_H_634D7DC412D24E0696239562AA94C143 +#ifndef SIMON_RENAMECATEGORIESELECTPARAMETERSPAGE_H_634D7DC412D24E0696239562AA94C143 +#define SIMON_RENAMECATEGORIESELECTPARAMETERSPAGE_H_634D7DC412D24E0696239562AA94C143 #include -#include "ui_renameterminalselectparameterspage.h" +#include "ui_renamecategoryselectparameterspage.h" /** @author Peter Grasch */ -class RenameTerminalSelectParametersPage : public QWizardPage +class RenameCategorySelectParametersPage : public QWizardPage { Q_OBJECT private: - Ui::RenameTerminalSelectParametersDlg ui; + Ui::RenameCategorySelectParametersDlg ui; public: - RenameTerminalSelectParametersPage(QWidget *parent); + RenameCategorySelectParametersPage(QWidget *parent); void initializePage(); - ~RenameTerminalSelectParametersPage(); + ~RenameCategorySelectParametersPage(); }; #endif diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.ui b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.ui similarity index 87% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.ui rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.ui index 4c14e89..bb22828 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalselectparameterspage.ui +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryselectparameterspage.ui @@ -1,7 +1,7 @@ - RenameTerminalSelectParametersDlg - + RenameCategorySelectParametersDlg + 0 @@ -32,14 +32,14 @@ - + - Old Terminal: + Old Category: - + diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.cpp b/simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.cpp similarity index 68% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.cpp rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.cpp index f7dcf75..8ef16e0 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.cpp +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.cpp @@ -17,40 +17,40 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "renameterminalwizard.h" +#include "renamecategorywizard.h" #include #include #include #include -#include "renameterminalselectparameterspage.h" -#include "renameterminalworkingpage.h" +#include "renamecategoryselectparameterspage.h" +#include "renamecategoryworkingpage.h" -RenameTerminalWizard::RenameTerminalWizard(QWidget* parent): SimonWizard(parent) +RenameCategoryWizard::RenameCategoryWizard(QWidget* parent): SimonWizard(parent) { - setWindowTitle(i18n("Rename terminal")); + setWindowTitle(i18n("Rename category")); addPage(createIntroPage()); addPage(createSelectParametersPage()); addPage(createWorkingPage()); addPage(createFinishedPage()); - setBanner("editterminal"); + setBanner("editcategory"); } -QWizardPage* RenameTerminalWizard::createSelectParametersPage() +QWizardPage* RenameCategoryWizard::createSelectParametersPage() { - return new RenameTerminalSelectParametersPage(this); + return new RenameCategorySelectParametersPage(this); } -QWizardPage* RenameTerminalWizard::createWorkingPage() +QWizardPage* RenameCategoryWizard::createWorkingPage() { - RenameTerminalWorkingPage *work = new RenameTerminalWorkingPage(this); + RenameCategoryWorkingPage *work = new RenameCategoryWorkingPage(this); connect(work, SIGNAL(done()), this, SLOT(next())); return work; } -QWizardPage* RenameTerminalWizard::createIntroPage() +QWizardPage* RenameCategoryWizard::createIntroPage() { QWizardPage *intro = new QWizardPage(this); QHBoxLayout *lay = new QHBoxLayout(intro); @@ -59,14 +59,14 @@ QWizardPage* RenameTerminalWizard::createIntroPage() intro->setLayout(lay); desc->setWordWrap(true); - intro->setTitle(i18n("Welcome to the renaming of a terminal")); - desc->setText(i18n("This assistant will allow you to rename an existing terminal.")); + intro->setTitle(i18n("Welcome to the renaming of a category")); + desc->setText(i18n("This assistant will allow you to rename an existing category.")); return intro; } -QWizardPage* RenameTerminalWizard::createFinishedPage() +QWizardPage* RenameCategoryWizard::createFinishedPage() { QWizardPage *finished = new QWizardPage(this); QHBoxLayout *lay = new QHBoxLayout(finished); @@ -76,12 +76,12 @@ QWizardPage* RenameTerminalWizard::createFinishedPage() desc->setWordWrap(true); finished->setTitle(i18n("Renaming complete")); - desc->setText(i18n("The terminal has been renamed.\n\nThank you for improving Simon.")); + desc->setText(i18n("The category has been renamed.\n\nThank you for improving Simon.")); return finished; } -RenameTerminalWizard::~RenameTerminalWizard() +RenameCategoryWizard::~RenameCategoryWizard() { } diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.h b/simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.h similarity index 81% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.h rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.h index a2e9358..483df0c 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalwizard.h +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategorywizard.h @@ -17,8 +17,8 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_RENAMETERMINALWIZARD_H_81323ACF45B7425ABFB0297D096887DA -#define SIMON_RENAMETERMINALWIZARD_H_81323ACF45B7425ABFB0297D096887DA +#ifndef SIMON_RENAMECATEGORYWIZARD_H_81323ACF45B7425ABFB0297D096887DA +#define SIMON_RENAMECATEGORYWIZARD_H_81323ACF45B7425ABFB0297D096887DA #include @@ -27,7 +27,7 @@ */ class QWizardPage; -class RenameTerminalWizard : public SimonWizard +class RenameCategoryWizard : public SimonWizard { Q_OBJECT private: @@ -36,9 +36,9 @@ class RenameTerminalWizard : public SimonWizard QWizardPage *createWorkingPage(); QWizardPage *createFinishedPage(); public: - RenameTerminalWizard(QWidget* parent); + RenameCategoryWizard(QWidget* parent); - ~RenameTerminalWizard(); + ~RenameCategoryWizard(); }; #endif diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.cpp b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.cpp similarity index 55% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.cpp rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.cpp index c7c7b26..0d4c9dc 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.cpp +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.cpp @@ -17,28 +17,28 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#include "renameterminalworkingpage.h" -#include "renameterminal.h" +#include "renamecategoryworkingpage.h" +#include "renamecategory.h" -RenameTerminalWorkingPage::RenameTerminalWorkingPage(QWidget* parent) +RenameCategoryWorkingPage::RenameCategoryWorkingPage(QWidget* parent) : QWizardPage(parent), complete(false), -renameTerminal(new RenameTerminal(this)) +renameCategory(new RenameCategory(this)) { - connect(renameTerminal, SIGNAL(progress(int)), this, SLOT(displayProgress(int))); - connect(renameTerminal, SIGNAL(done()), this, SLOT(finish())); + connect(renameCategory, SIGNAL(progress(int)), this, SLOT(displayProgress(int))); + connect(renameCategory, SIGNAL(done()), this, SLOT(finish())); ui.setupUi(this); - setTitle(i18n("Renaming terminal...")); + setTitle(i18n("Renaming category...")); } -void RenameTerminalWorkingPage::displayProgress(int progress) +void RenameCategoryWorkingPage::displayProgress(int progress) { ui.pgProgress->setValue(progress); } -void RenameTerminalWorkingPage::finish() +void RenameCategoryWorkingPage::finish() { complete = true; emit completeChanged(); @@ -46,18 +46,18 @@ void RenameTerminalWorkingPage::finish() } -void RenameTerminalWorkingPage::initializePage() +void RenameCategoryWorkingPage::initializePage() { //do the work - renameTerminal->setOldName(field("renameTerminal").toString()); + renameCategory->setOldName(field("renameCategory").toString()); - renameTerminal->setNewName(field("renameNewName").toString()); - renameTerminal->setIncludeShadow((field("renameIncludeShadow").toBool())); - renameTerminal->setIncludeGrammar(field("renameIncludeGrammar").toBool()); - renameTerminal->start(); + renameCategory->setNewName(field("renameNewName").toString()); + renameCategory->setIncludeShadow((field("renameIncludeShadow").toBool())); + renameCategory->setIncludeGrammar(field("renameIncludeGrammar").toBool()); + renameCategory->start(); } -RenameTerminalWorkingPage::~RenameTerminalWorkingPage() +RenameCategoryWorkingPage::~RenameCategoryWorkingPage() { } diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.h b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.h similarity index 73% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.h rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.h index 80815b6..5588da5 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.h +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.h @@ -17,16 +17,16 @@ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. */ -#ifndef SIMON_RENAMETERMINALWORKINGPAGE_H_3D51221A254347329D67EF19AE2477BB -#define SIMON_RENAMETERMINALWORKINGPAGE_H_3D51221A254347329D67EF19AE2477BB +#ifndef SIMON_RENAMECATEGORYWORKINGPAGE_H_3D51221A254347329D67EF19AE2477BB +#define SIMON_RENAMECATEGORYWORKINGPAGE_H_3D51221A254347329D67EF19AE2477BB #include -#include "ui_renameterminalworkingpage.h" +#include "ui_renamecategoryworkingpage.h" /** @author Peter Grasch */ -class RenameTerminal; -class RenameTerminalWorkingPage : public QWizardPage +class RenameCategory; +class RenameCategoryWorkingPage : public QWizardPage { Q_OBJECT signals: @@ -35,17 +35,17 @@ class RenameTerminalWorkingPage : public QWizardPage void finish(); void displayProgress(int); private: - Ui::RenameTerminalWorkingPage ui; + Ui::RenameCategoryWorkingPage ui; bool complete; - RenameTerminal *renameTerminal; + RenameCategory *renameCategory; public: - RenameTerminalWorkingPage(QWidget *parent); + RenameCategoryWorkingPage(QWidget *parent); void initializePage(); bool isComplete() const { return this->complete; } - ~RenameTerminalWorkingPage(); + ~RenameCategoryWorkingPage(); }; #endif diff --git a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.ui b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.ui similarity index 89% rename from simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.ui rename to simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.ui index 788f235..1863625 100644 --- a/simon/src/simonmodelmanagementui/RenameTerminal/renameterminalworkingpage.ui +++ b/simon/src/simonmodelmanagementui/RenameCategory/renamecategoryworkingpage.ui @@ -1,6 +1,6 @@ - RenameTerminalWorkingPage - + RenameCategoryWorkingPage + 0 @@ -16,7 +16,7 @@ - The terminal is now being renamed. + The category is now being renamed. Depending on your parameters this could take a few minutes. diff --git a/simon/src/simonmodelmanagementui/TrainSamples/trainingswizard.cpp b/simon/src/simonmodelmanagementui/TrainSamples/trainingswizard.cpp index e279bf6..b14a9b9 100644 --- a/simon/src/simonmodelmanagementui/TrainSamples/trainingswizard.cpp +++ b/simon/src/simonmodelmanagementui/TrainSamples/trainingswizard.cpp @@ -71,7 +71,7 @@ bool TrainingsWizard::init(const QList& wList, bool smartSentences) //resolve sentences foreach (Word *w, wList) { QStringList examples = ScenarioManager::getInstance()-> - getCurrentScenario()->getExampleSentences(w->getWord(), w->getTerminal(), 1); + getCurrentScenario()->getExampleSentences(w->getWord(), w->getCategory(), 1); if (examples.isEmpty()) pages << w->getWord(); else pages << examples[0]; diff --git a/simon/src/simonmodelmanagementui/deleteworddialog.cpp b/simon/src/simonmodelmanagementui/deleteworddialog.cpp index f4f45dc..d4f3911 100644 --- a/simon/src/simonmodelmanagementui/deleteworddialog.cpp +++ b/simon/src/simonmodelmanagementui/deleteworddialog.cpp @@ -48,11 +48,11 @@ int DeleteWordDialog::exec(Word *word, bool isShadowed) { ui.lbName->setText(word->getWord()); ui.lbPronunciation->setText(word->getPronunciation()); - ui.lbTerminal->setText(word->getTerminal()); + ui.lbCategory->setText(word->getCategory()); ui.lbRecognitionRate->setText(QString::number(word->getPropability())); - ui.rbTerminal->setEnabled(!isShadowed); - ui.lbTerminalDesc->setEnabled(!isShadowed); + ui.rbCategory->setEnabled(!isShadowed); + ui.lbCategoryDesc->setEnabled(!isShadowed); ui.rbShadow->setEnabled(!isShadowed); ui.lbShadowDesc->setEnabled(!isShadowed); @@ -60,7 +60,7 @@ int DeleteWordDialog::exec(Word *word, bool isShadowed) ui.rbSoftDelete->setChecked(true); } else { - ui.rbTerminal->setChecked(true); + ui.rbCategory->setChecked(true); } return KDialog::exec(); } @@ -68,7 +68,7 @@ int DeleteWordDialog::exec(Word *word, bool isShadowed) DeleteWordDialog::DeletionType DeleteWordDialog::getDeletionType() { - if (ui.rbTerminal->isChecked()) + if (ui.rbCategory->isChecked()) return DeleteWordDialog::MoveToUnused; if (ui.rbShadow->isChecked()) return DeleteWordDialog::MoveToShadow; diff --git a/simon/src/simonmodelmanagementui/editword.ui b/simon/src/simonmodelmanagementui/editword.ui index 7f17143..ff21752 100644 --- a/simon/src/simonmodelmanagementui/editword.ui +++ b/simon/src/simonmodelmanagementui/editword.ui @@ -53,7 +53,7 @@ - + ... @@ -92,7 +92,7 @@ leWord leSampa cbType - tbAddTerminal + tbAddCategory diff --git a/simon/src/simonmodelmanagementui/editworddialog.cpp b/simon/src/simonmodelmanagementui/editworddialog.cpp index af86f68..c4693c4 100644 --- a/simon/src/simonmodelmanagementui/editworddialog.cpp +++ b/simon/src/simonmodelmanagementui/editworddialog.cpp @@ -36,8 +36,8 @@ EditWordDialog::EditWordDialog(QWidget* parent, Qt::WindowFlags f) ui.setupUi(widget); setMainWidget( widget ); setCaption( i18n("Edit Word") ); - ui.tbAddTerminal->setIcon(KIcon("list-add")); - connect(ui.tbAddTerminal, SIGNAL(clicked()), this, SLOT(addTerminal())); + ui.tbAddCategory->setIcon(KIcon("list-add")); + connect(ui.tbAddCategory, SIGNAL(clicked()), this, SLOT(addCategory())); } @@ -50,17 +50,17 @@ int EditWordDialog::exec(Word *word) { ui.leWord->setText(word->getWord()); ui.cbType->clear(); - QStringList terminals = ScenarioManager::getInstance()->getTerminals( + QStringList categories = ScenarioManager::getInstance()->getCategories( (SpeechModel::ModelElements) (SpeechModel::ShadowVocabulary| SpeechModel::ScenarioVocabulary| SpeechModel::AllScenariosVocabulary| SpeechModel::AllScenariosGrammar| SpeechModel::ScenarioGrammar)); - if (!terminals.contains(i18nc("Standard category for unused words", "Unused"))) - terminals << i18nc("Standard category for unused words", "Unused"); - ui.cbType->addItems(terminals); - ui.cbType->setCurrentIndex(ui.cbType->findText(word->getTerminal())); + if (!categories.contains(i18nc("Standard category for unused words", "Unused"))) + categories << i18nc("Standard category for unused words", "Unused"); + ui.cbType->addItems(categories); + ui.cbType->setCurrentIndex(ui.cbType->findText(word->getCategory())); ui.leSampa->setText(word->getPronunciation()); int ret = KDialog::exec(); @@ -68,7 +68,7 @@ int EditWordDialog::exec(Word *word) if (ret) { //update word word->setWord(ui.leWord->text()); - word->setTerminal(ui.cbType->currentText()); + word->setCategory(ui.cbType->currentText()); word->setPronunciation(ui.leSampa->text()); } @@ -77,15 +77,15 @@ int EditWordDialog::exec(Word *word) /** - * \brief Queries the User for the new name and adds the terminal to the list + * \brief Queries the User for the new name and adds the category to the list * \author Peter Grasch */ -void EditWordDialog::addTerminal() +void EditWordDialog::addCategory() { - QString newTerminal = KInputDialog::getText(i18n("Add Category"), i18n("Name of new category:")); + QString newCategory = KInputDialog::getText(i18n("Add Category"), i18n("Name of new category:")); - if (newTerminal.isEmpty()) return; + if (newCategory.isEmpty()) return; - ui.cbType->addItem(newTerminal); + ui.cbType->addItem(newCategory); ui.cbType->setCurrentIndex(ui.cbType->count()-1); } diff --git a/simon/src/simonmodelmanagementui/editworddialog.h b/simon/src/simonmodelmanagementui/editworddialog.h index b8c3c4f..9ed69e2 100644 --- a/simon/src/simonmodelmanagementui/editworddialog.h +++ b/simon/src/simonmodelmanagementui/editworddialog.h @@ -40,7 +40,7 @@ class EditWordDialog : public KDialog int exec(Word *word); private slots: - void addTerminal(); + void addCategory(); private: Ui::EditWordView ui; diff --git a/simon/src/simonmodelmanagementui/grammarviewprivate.cpp b/simon/src/simonmodelmanagementui/grammarviewprivate.cpp index 2f613c6..997e7bd 100644 --- a/simon/src/simonmodelmanagementui/grammarviewprivate.cpp +++ b/simon/src/simonmodelmanagementui/grammarviewprivate.cpp @@ -19,8 +19,8 @@ #include "grammarviewprivate.h" #include "ImportGrammar/importgrammarwizard.h" -#include "MergeTerminals/mergeterminalswizard.h" -#include "RenameTerminal/renameterminalwizard.h" +#include "MergeCategories/mergecategorieswizard.h" +#include "RenameCategory/renamecategorywizard.h" #include #include @@ -116,10 +116,10 @@ void GrammarViewPrivate::displayScenarioPrivate(Scenario *scenario) void GrammarViewPrivate::showRenameWizard() { - QPointer renameTerminalWizard = new RenameTerminalWizard(this); - renameTerminalWizard->restart(); - renameTerminalWizard->exec(); - delete renameTerminalWizard; + QPointer renameCategoryWizard = new RenameCategoryWizard(this); + renameCategoryWizard->restart(); + renameCategoryWizard->exec(); + delete renameCategoryWizard; currentSelectionChanged(); } @@ -135,10 +135,10 @@ void GrammarViewPrivate::showImportWizard() void GrammarViewPrivate::showMergeWizard() { - QPointer mergeTerminalsWizard = new MergeTerminalsWizard(this); - mergeTerminalsWizard->restart(); - mergeTerminalsWizard->exec(); - delete mergeTerminalsWizard; + QPointer mergeCategoriesWizard = new MergeCategoriesWizard(this); + mergeCategoriesWizard->restart(); + mergeCategoriesWizard->exec(); + delete mergeCategoriesWizard; currentSelectionChanged(); } diff --git a/simon/src/simonmodelmanagementui/removeword.ui b/simon/src/simonmodelmanagementui/removeword.ui index 80e3c71..bfbc449 100644 --- a/simon/src/simonmodelmanagementui/removeword.ui +++ b/simon/src/simonmodelmanagementui/removeword.ui @@ -67,14 +67,14 @@ - + - Terminal: + Category: - + TextLabel @@ -148,9 +148,9 @@ - + - Move the word to the "Unused" terminal + Move the word to the "Unused" category true @@ -176,7 +176,7 @@ - + The word will stay in your active dictionary and all samples will be kept. The samples will still be used to improve the acoustic model but in Simon the word will no longer be considered during the recognition. diff --git a/simon/src/simonmodelmanagementui/vocabularyviewprivate.cpp b/simon/src/simonmodelmanagementui/vocabularyviewprivate.cpp index 9552c9c..35788ad 100644 --- a/simon/src/simonmodelmanagementui/vocabularyviewprivate.cpp +++ b/simon/src/simonmodelmanagementui/vocabularyviewprivate.cpp @@ -231,7 +231,7 @@ void VocabularyViewPrivate::deleteSelectedWord() //delete the word switch (del->getDeletionType()) { case DeleteWordDialog::MoveToUnused: - w->setTerminal(i18nc("Standard name for terminals that are not used for the recognition", "Unused")); + w->setCategory(i18nc("Standard name for categories that are not used for the recognition", "Unused")); scenario->save(); //save changes break; case DeleteWordDialog::MoveToShadow: @@ -301,7 +301,7 @@ void VocabularyViewPrivate::copyWordToTrain() if (!w) return; trainingVocabulary.append(w); - ui.lwTrainingWords->addItem(QString("%1 (%2)").arg(w->getWord()).arg(w->getTerminal())); + ui.lwTrainingWords->addItem(QString("%1 (%2)").arg(w->getWord()).arg(w->getCategory())); } diff --git a/simon/src/simonrecognitioncontrol/recognitioncontrol.cpp b/simon/src/simonrecognitioncontrol/recognitioncontrol.cpp index 9641190..b2072cc 100644 --- a/simon/src/simonrecognitioncontrol/recognitioncontrol.cpp +++ b/simon/src/simonrecognitioncontrol/recognitioncontrol.cpp @@ -1613,7 +1613,7 @@ void RecognitionControl::wordUndefined(const QString& word) void RecognitionControl::classUndefined(const QString& undefClass) { - KMessageBox::sorry(0, i18n("Your grammar uses the undefined terminal \"%1\".\n\nPlease add a word that uses this terminal or remove the structure(s) containing the terminal from your grammar.", undefClass)); + KMessageBox::sorry(0, i18n("Your grammar uses the undefined category \"%1\".\n\nPlease add a word that uses this category or remove the structure(s) containing the category from your grammar.", undefClass)); } diff --git a/simon/src/simonsampleshare/LICENSE b/simon/src/simonsampleshare/LICENSE index 94a9ed0..f241592 100755 --- a/simon/src/simonsampleshare/LICENSE +++ b/simon/src/simonsampleshare/LICENSE @@ -649,7 +649,7 @@ the "copyright" line and a pointer to where the full notice is found. Also add information on how to contact you by electronic and paper mail. - If the program does terminal interaction, make it output a short + If the program does category interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) diff --git a/simon/themes/default/editterminal.png b/simon/themes/default/editcategory.png similarity index 100% rename from simon/themes/default/editterminal.png rename to simon/themes/default/editcategory.png diff --git a/simon/themes/default/l10n/ca/editterminal.png b/simon/themes/default/l10n/ca/editcategory.png similarity index 100% rename from simon/themes/default/l10n/ca/editterminal.png rename to simon/themes/default/l10n/ca/editcategory.png diff --git a/simon/themes/default/l10n/de/editterminal.png b/simon/themes/default/l10n/de/editcategory.png similarity index 100% rename from simon/themes/default/l10n/de/editterminal.png rename to simon/themes/default/l10n/de/editcategory.png diff --git a/simon/themes/default/l10n/en/editterminal.png b/simon/themes/default/l10n/en/editcategory.png similarity index 100% rename from simon/themes/default/l10n/en/editterminal.png rename to simon/themes/default/l10n/en/editcategory.png diff --git a/simon/themes/default/template.xcf b/simon/themes/default/template.xcf index 1175ab8..ccde45f 100644 Binary files a/simon/themes/default/template.xcf and b/simon/themes/default/template.xcf differ diff --git a/simonlib/simonscenarios/activevocabulary.cpp b/simonlib/simonscenarios/activevocabulary.cpp index 4f6020a..7b1c5b2 100644 --- a/simonlib/simonscenarios/activevocabulary.cpp +++ b/simonlib/simonscenarios/activevocabulary.cpp @@ -119,9 +119,9 @@ bool ActiveVocabulary::empty() } -bool ActiveVocabulary::renameTerminal(const QString& from, const QString& to) +bool ActiveVocabulary::renameCategory(const QString& from, const QString& to) { - if (Vocabulary::renameTerminal(from, to)) + if (Vocabulary::renameCategory(from, to)) return parentScenario->save(); return false; } diff --git a/simonlib/simonscenarios/activevocabulary.h b/simonlib/simonscenarios/activevocabulary.h index 2835c65..e3e13c4 100644 --- a/simonlib/simonscenarios/activevocabulary.h +++ b/simonlib/simonscenarios/activevocabulary.h @@ -48,7 +48,7 @@ class MODELMANAGEMENT_EXPORT ActiveVocabulary : public Vocabulary, public Scenar bool takeWord(Word*); bool deSerialize(const QDomElement&); QDomElement serialize(QDomDocument *doc); - bool renameTerminal(const QString& from, const QString& to); + bool renameCategory(const QString& from, const QString& to); bool empty(); }; #endif diff --git a/simonlib/simonscenarios/grammar.cpp b/simonlib/simonscenarios/grammar.cpp index 24ef5d3..7e76556 100644 --- a/simonlib/simonscenarios/grammar.cpp +++ b/simonlib/simonscenarios/grammar.cpp @@ -95,28 +95,28 @@ QDomElement Grammar::serialize(QDomDocument *doc) } -bool Grammar::renameTerminal(QString terminal, const QString& newName) +bool Grammar::renameCategory(QString category, const QString& newName) { - kDebug() << "Renaming terminal: " << terminal << newName; + kDebug() << "Renaming category: " << category << newName; QMutexLocker lock(&structuresLock); - //make the terminal regex-able :) - /*terminal.replace('.', "\\."); - terminal.replace('-', "\\-"); - terminal.replace('+', "\\+"); - terminal.replace('!', "\\!"); - terminal.replace('?', "\\?"); - terminal.replace('*', "\\*"); - terminal.replace('\\', "\\\\"); - terminal.replace('^', "\\^"); - terminal.replace('$', "\\$");*/ + //make the category regex-able :) + /*category.replace('.', "\\."); + category.replace('-', "\\-"); + category.replace('+', "\\+"); + category.replace('!', "\\!"); + category.replace('?', "\\?"); + category.replace('*', "\\*"); + category.replace('\\', "\\\\"); + category.replace('^', "\\^"); + category.replace('$', "\\$");*/ QStringList newStructures; //replace using regex patterns for (int j=0; j < m_structures.count(); j++) { QStringList currentStructure = m_structures.at(j).split(' '); for (int i=0; i < currentStructure.count(); i++) { - if (currentStructure[i] == terminal) + if (currentStructure[i] == category) currentStructure.replace(i, newName); } m_structures.replace(j, currentStructure.join(" ")); @@ -126,28 +126,28 @@ bool Grammar::renameTerminal(QString terminal, const QString& newName) } -QStringList Grammar::getTerminals() +QStringList Grammar::getCategories() { QMutexLocker lock(&structuresLock); QStringList out; - QStringList terminalsInStruct; + QStringList categoriesInStruct; foreach (const QString& structure, m_structures) { - terminalsInStruct = getTerminalsForStructure(structure); - for (int j=0; j < terminalsInStruct.count(); j++) - if (!out.contains(terminalsInStruct[j])) - out << terminalsInStruct[j]; + categoriesInStruct = getCategoriesForStructure(structure); + for (int j=0; j < categoriesInStruct.count(); j++) + if (!out.contains(categoriesInStruct[j])) + out << categoriesInStruct[j]; } return out; } -QStringList Grammar::getTerminalsForStructure(const QString &structure) +QStringList Grammar::getCategoriesForStructure(const QString &structure) { return structure.split(' '); } -QString Grammar::getExampleSentence(const QString& terminal) +QString Grammar::getExampleSentence(const QString& category) { if (m_structures.count() == 0) return QString(); @@ -155,12 +155,12 @@ QString Grammar::getExampleSentence(const QString& terminal) //start at this random position for (int i=start; i < m_structures.count(); i++) - if (m_structures.at(i).contains(terminal)) + if (m_structures.at(i).contains(category)) return m_structures.at(i); //not found? ok start backwards for (int i=start-1; i > 0; i--) - if (m_structures.at(i).contains(terminal)) + if (m_structures.at(i).contains(category)) return m_structures.at(i); return QString(); //no sentence found diff --git a/simonlib/simonscenarios/grammar.h b/simonlib/simonscenarios/grammar.h index 80b2410..721dcf9 100644 --- a/simonlib/simonscenarios/grammar.h +++ b/simonlib/simonscenarios/grammar.h @@ -54,9 +54,9 @@ class MODELMANAGEMENT_EXPORT Grammar : public ScenarioObject, public QAbstractIt bool deSerialize(const QDomElement&); QDomElement serialize(QDomDocument *doc); static QDomElement createEmpty(QDomDocument *doc); - bool renameTerminal(QString terminal, const QString& newName); + bool renameCategory(QString category, const QString& newName); - QString getExampleSentence(const QString& terminal); + QString getExampleSentence(const QString& category); QString getStructure(int index); @@ -64,8 +64,8 @@ class MODELMANAGEMENT_EXPORT Grammar : public ScenarioObject, public QAbstractIt bool addStructure(const QString& newStructure, bool save=true); bool deleteStructure(int index); - static QStringList getTerminalsForStructure(const QString& structure); - QStringList getTerminals(); + static QStringList getCategoriesForStructure(const QString& structure); + QStringList getCategories(); QStringList getStructures() const { return m_structures; } int structureCount() { return m_structures.count(); } diff --git a/simonlib/simonscenarios/scenario.cpp b/simonlib/simonscenarios/scenario.cpp index 17817e1..7445a09 100644 --- a/simonlib/simonscenarios/scenario.cpp +++ b/simonlib/simonscenarios/scenario.cpp @@ -789,38 +789,38 @@ bool Scenario::addStructures(const QStringList& newStructures) } -QStringList Scenario::getTerminals(SpeechModel::ModelElements elements) +QStringList Scenario::getCategories(SpeechModel::ModelElements elements) { - QStringList terminals; + QStringList categories; if (elements & SpeechModel::ScenarioVocabulary) - terminals = m_vocabulary->getTerminals(); + categories = m_vocabulary->getCategories(); if (elements & SpeechModel::ScenarioGrammar) { - QStringList grammarTerminals = m_grammar->getTerminals(); - foreach (const QString& terminal, grammarTerminals) - if (!terminals.contains(terminal)) - terminals << terminal; + QStringList grammarCategories = m_grammar->getCategories(); + foreach (const QString& category, grammarCategories) + if (!categories.contains(category)) + categories << category; } - return terminals; + return categories; } -bool Scenario::renameTerminal(const QString& terminal, const QString& newName, SpeechModel::ModelElements affect) +bool Scenario::renameCategory(const QString& category, const QString& newName, SpeechModel::ModelElements affect) { bool success = true; bool scenarioChanged = false; if (affect & SpeechModel::ScenarioVocabulary) { - if (m_vocabulary->renameTerminal(terminal, newName)) + if (m_vocabulary->renameCategory(category, newName)) scenarioChanged=true; else success=false; } if (affect & SpeechModel::ScenarioGrammar) { - if (m_grammar->renameTerminal(terminal, newName)) + if (m_grammar->renameCategory(category, newName)) scenarioChanged=true; else success=false; @@ -838,39 +838,39 @@ QList Scenario::findWords(const QString& name, Vocabulary::MatchType type } -QList Scenario::findWordsByTerminal(const QString& name) +QList Scenario::findWordsByCategory(const QString& name) { - return m_vocabulary->findWordsByTerminal(name); + return m_vocabulary->findWordsByCategory(name); } -QString Scenario::fillGrammarSentenceWithExamples(const QString& terminalSentence, bool &ok, const QString& toDemonstrate, -const QString& toDemonstrateTerminal) +QString Scenario::fillGrammarSentenceWithExamples(const QString& categorySentence, bool &ok, const QString& toDemonstrate, +const QString& toDemonstrateCategory) { - int terminalOccuranceCount = terminalSentence.count(toDemonstrateTerminal); - //this occurrence of the terminal in the sentence is going to be replaced + int categoryOccuranceCount = categorySentence.count(toDemonstrateCategory); + //this occurrence of the category in the sentence is going to be replaced //by the word we should put in a random sentence - int selectedOccurance = qrand() % terminalOccuranceCount; + int selectedOccurance = qrand() % categoryOccuranceCount; - QStringList segmentedTerminals = terminalSentence.split(' '); + QStringList segmentedCategories = categorySentence.split(' '); QStringList actualSentence; ok = true; int currentOccuranceCounter = 0; - foreach (const QString& terminalNow, segmentedTerminals) { - if (!toDemonstrate.isNull() && (terminalNow == toDemonstrateTerminal)) { + foreach (const QString& categoryNow, segmentedCategories) { + if (!toDemonstrate.isNull() && (categoryNow == toDemonstrateCategory)) { if (currentOccuranceCounter++ == selectedOccurance) { actualSentence.append(toDemonstrate); continue; } } - QString randomWord = m_vocabulary->getRandomWord(terminalNow); + QString randomWord = m_vocabulary->getRandomWord(categoryNow); if (randomWord.isNull()) { - if (!toDemonstrate.isNull() && (terminalNow == toDemonstrateTerminal)) { + if (!toDemonstrate.isNull() && (categoryNow == toDemonstrateCategory)) { actualSentence.append(toDemonstrate); } else ok = false; } @@ -883,21 +883,21 @@ const QString& toDemonstrateTerminal) } -QStringList Scenario::getExampleSentences(const QString& name, const QString& terminal, int count) +QStringList Scenario::getExampleSentences(const QString& name, const QString& category, int count) { QStringList out; int failedCounter = 0; for (int i=0; i < count; i++) { - QString terminalSentence = m_grammar->getExampleSentence(terminal); - if (terminalSentence.isNull()) { + QString categorySentence = m_grammar->getExampleSentence(category); + if (categorySentence.isNull()) { //no sentence found return out; } bool ok = true; - QString resolvedSentence = fillGrammarSentenceWithExamples(terminalSentence, ok, name, terminal); + QString resolvedSentence = fillGrammarSentenceWithExamples(categorySentence, ok, name, category); if (ok) { out << resolvedSentence; @@ -915,11 +915,11 @@ QStringList Scenario::getExampleSentences(const QString& name, const QString& te QStringList Scenario::getAllPossibleSentences() { - QStringList terminalSentences = m_grammar->getStructures(); + QStringList categorySentences = m_grammar->getStructures(); QStringList allSentences; - foreach (const QString& structure, terminalSentences) { + foreach (const QString& structure, categorySentences) { allSentences.append(getAllPossibleSentencesOfStructure(structure)); } return allSentences; @@ -943,7 +943,7 @@ QStringList Scenario::getAllPossibleSentencesOfStructure(const QString& structur QList< QList > sentenceMatrix; foreach (const QString& element, structureElements) - sentenceMatrix.append(m_vocabulary->findWordsByTerminal(element)); + sentenceMatrix.append(m_vocabulary->findWordsByCategory(element)); //sentences: ( (Window, Test), (Next, Previous) ) @@ -977,9 +977,9 @@ QStringList Scenario::getValidSentences(QList< QList > sentenceMatrix, in } -QString Scenario::getRandomWord(const QString& terminal) +QString Scenario::getRandomWord(const QString& category) { - return m_vocabulary->getRandomWord(terminal); + return m_vocabulary->getRandomWord(category); } @@ -989,9 +989,9 @@ bool Scenario::containsWord(const QString& word) } -bool Scenario::containsWord(const QString& word, const QString& terminal, const QString& pronunciation) +bool Scenario::containsWord(const QString& word, const QString& category, const QString& pronunciation) { - return (m_vocabulary->containsWord(word, terminal, pronunciation)); + return (m_vocabulary->containsWord(word, category, pronunciation)); } diff --git a/simonlib/simonscenarios/scenario.h b/simonlib/simonscenarios/scenario.h index 61eafa8..2f75025 100644 --- a/simonlib/simonscenarios/scenario.h +++ b/simonlib/simonscenarios/scenario.h @@ -108,23 +108,23 @@ class MODELMANAGEMENT_EXPORT Scenario : public QObject bool addStructures(const QStringList& newStructures); QList findWords(const QString& name, Vocabulary::MatchType type); - QList findWordsByTerminal(const QString& name); + QList findWordsByCategory(const QString& name); QStringList getAllPossibleSentences(); QStringList getAllPossibleSentencesOfStructure(const QString& structure, int* alreadyFoundExamples=0); QStringList getExampleSentencesOfStructure(const QString& structure); - QStringList getExampleSentences(const QString& name, const QString& terminal, int count); - QString fillGrammarSentenceWithExamples(const QString& terminalSentence, bool &ok, const QString& toDemonstrate=QString(), - const QString& toDemonstrateTerminal=QString()); + QStringList getExampleSentences(const QString& name, const QString& category, int count); + QString fillGrammarSentenceWithExamples(const QString& categorySentence, bool &ok, const QString& toDemonstrate=QString(), + const QString& toDemonstrateCategory=QString()); - QStringList getTerminals(SpeechModel::ModelElements elements); - bool renameTerminal(const QString& terminal, const QString& newName, SpeechModel::ModelElements affect); + QStringList getCategories(SpeechModel::ModelElements elements); + bool renameCategory(const QString& category, const QString& newName, SpeechModel::ModelElements affect); - QString getRandomWord(const QString& terminal); + QString getRandomWord(const QString& category); bool containsWord(const QString& word); - bool containsWord(const QString& word, const QString& terminal, const QString& pronunciation); + bool containsWord(const QString& word, const QString& category, const QString& pronunciation); static QDateTime skimDate(QString path=QString()); bool skim(QString path=QString(), QDomDocument* doc=0, bool deleteDoc=false); diff --git a/simonlib/simonscenarios/scenariomanager.cpp b/simonlib/simonscenarios/scenariomanager.cpp index 949b5a3..61c9dad 100644 --- a/simonlib/simonscenarios/scenariomanager.cpp +++ b/simonlib/simonscenarios/scenariomanager.cpp @@ -334,12 +334,12 @@ void ScenarioManager::scenarioActivationChanged() } -QStringList ScenarioManager::getTerminals(SpeechModel::ModelElements elements) +QStringList ScenarioManager::getCategories(SpeechModel::ModelElements elements) { - QStringList terminals; + QStringList categories; if ((elements & SpeechModel::ScenarioGrammar) || (elements & SpeechModel::ScenarioVocabulary)) - terminals << getCurrentScenario()->getTerminals(elements); + categories << getCurrentScenario()->getCategories(elements); SpeechModel::ModelElements foreignElements; if (elements & SpeechModel::AllScenariosGrammar) @@ -348,35 +348,35 @@ QStringList ScenarioManager::getTerminals(SpeechModel::ModelElements elements) foreignElements = (SpeechModel::ModelElements) (((int)foreignElements)|((int)SpeechModel::ScenarioVocabulary)); foreach (Scenario *s, scenarios) { - QStringList foreignTerminals = s->getTerminals(foreignElements); - foreach (const QString& terminal, foreignTerminals) - if (!terminals.contains(terminal)) - terminals << terminal; + QStringList foreignCategories = s->getCategories(foreignElements); + foreach (const QString& category, foreignCategories) + if (!categories.contains(category)) + categories << category; } if (elements & SpeechModel::ShadowVocabulary) { - QStringList shadowTerminals = shadowVocab->getTerminals(); - foreach (const QString& terminal, shadowTerminals) - if (!terminals.contains(terminal)) - terminals << terminal; + QStringList shadowCategories = shadowVocab->getCategories(); + foreach (const QString& category, shadowCategories) + if (!categories.contains(category)) + categories << category; } - terminals.sort(); + categories.sort(); - return terminals; + return categories; } -bool ScenarioManager::renameTerminal(const QString& terminal, const QString& newName, SpeechModel::ModelElements affect) +bool ScenarioManager::renameCategory(const QString& category, const QString& newName, SpeechModel::ModelElements affect) { bool success = true; if (affect & SpeechModel::ShadowVocabulary) { - if (!(shadowVocab->renameTerminal(terminal, newName))) + if (!(shadowVocab->renameCategory(category, newName))) success=false; } - if (!getCurrentScenario()->renameTerminal(terminal, newName, affect)) + if (!getCurrentScenario()->renameCategory(category, newName, affect)) success = false; return success; @@ -406,23 +406,23 @@ QList ScenarioManager::findWords(const QString& name, SpeechModel::ModelE } -QList ScenarioManager::findWordsByTerminal(const QString& name, SpeechModel::ModelElements elements) +QList ScenarioManager::findWordsByCategory(const QString& name, SpeechModel::ModelElements elements) { QList words; if (elements & SpeechModel::ShadowVocabulary) { - QList newWords = shadowVocab->findWordsByTerminal(name); + QList newWords = shadowVocab->findWordsByCategory(name); words.append(newWords); } if (elements & SpeechModel::AllScenariosVocabulary) { foreach (Scenario* s, scenarios) { - QList newWords = s->findWordsByTerminal(name); + QList newWords = s->findWordsByCategory(name); kDebug() << "Got " << newWords.count() << " words from " << s->id(); words.append(newWords); } } else if (elements & SpeechModel::ScenarioVocabulary) { - QList newWords = getCurrentScenario()->findWordsByTerminal(name); + QList newWords = getCurrentScenario()->findWordsByCategory(name); words.append(newWords); } @@ -430,19 +430,19 @@ QList ScenarioManager::findWordsByTerminal(const QString& name, SpeechMod } -QStringList ScenarioManager::getExampleSentences(const QString& name, const QString& terminal, int count, SpeechModel::ModelElements elements) +QStringList ScenarioManager::getExampleSentences(const QString& name, const QString& category, int count, SpeechModel::ModelElements elements) { QStringList outSentences; if (elements == SpeechModel::AllScenariosGrammar) { foreach (Scenario* s, scenarios) { - outSentences.append(s->getExampleSentences(name, terminal, count)); + outSentences.append(s->getExampleSentences(name, category, count)); } } kDebug() << "Out sentences: " << outSentences; if (elements == SpeechModel::ScenarioGrammar) { - outSentences.append(getCurrentScenario()->getExampleSentences(name, terminal, count)); + outSentences.append(getCurrentScenario()->getExampleSentences(name, category, count)); } kDebug() << "Out sentences: " << outSentences; diff --git a/simonlib/simonscenarios/scenariomanager.h b/simonlib/simonscenarios/scenariomanager.h index c21a531..e378992 100644 --- a/simonlib/simonscenarios/scenariomanager.h +++ b/simonlib/simonscenarios/scenariomanager.h @@ -88,13 +88,13 @@ class MODELMANAGEMENT_EXPORT ScenarioManager : public QObject bool storeScenario(const QString& id, const QByteArray& data); - QStringList getTerminals(SpeechModel::ModelElements elements); - bool renameTerminal(const QString& terminal, const QString& newName, SpeechModel::ModelElements affect); + QStringList getCategories(SpeechModel::ModelElements elements); + bool renameCategory(const QString& category, const QString& newName, SpeechModel::ModelElements affect); QList findWords(const QString& name, SpeechModel::ModelElements elements, Vocabulary::MatchType); - QList findWordsByTerminal(const QString& name, SpeechModel::ModelElements elements); + QList findWordsByCategory(const QString& name, SpeechModel::ModelElements elements); - QStringList getExampleSentences(const QString& name, const QString& terminal, int count, SpeechModel::ModelElements elements); + QStringList getExampleSentences(const QString& name, const QString& category, int count, SpeechModel::ModelElements elements); bool setupScenarios(bool forceChange=false); void setupAllChildScenarios(); diff --git a/simonlib/simonscenarios/shadowvocabulary.cpp b/simonlib/simonscenarios/shadowvocabulary.cpp index b17b99c..23c816e 100644 --- a/simonlib/simonscenarios/shadowvocabulary.cpp +++ b/simonlib/simonscenarios/shadowvocabulary.cpp @@ -69,9 +69,9 @@ bool ShadowVocabulary::reset(QIODevice* f) // // a: l // - // + // // NOM - // + // // f->readLine(); //skip word f->readLine(); //skip name @@ -82,16 +82,16 @@ bool ShadowVocabulary::reset(QIODevice* f) QString pronunciation = QString::fromUtf8(f->readLine()).trimmed(); f->readLine(); //skip pronunciationend - f->readLine(); //skip terminal - QString terminal = QString::fromUtf8(f->readLine()).trimmed(); - f->readLine(); //skip terminalend + f->readLine(); //skip category + QString category = QString::fromUtf8(f->readLine()).trimmed(); + f->readLine(); //skip categoryend f->readLine(); //skip wordend - if (terminal.isEmpty()) continue; + if (category.isEmpty()) continue; - if (!terminals.contains(terminal)) terminals << terminal; + if (!categories.contains(category)) categories << category; - m_words.append(new Word(name, pronunciation, terminal)); + m_words.append(new Word(name, pronunciation, category)); } QAbstractItemModel::reset(); loadFailed = false; @@ -140,9 +140,9 @@ bool ShadowVocabulary::save() // // a: l // - // + // // NOM - // + // // shadowVocabFile->write("\n"); shadowVocabFile->write("\t\n"); @@ -153,9 +153,9 @@ bool ShadowVocabulary::save() shadowVocabFile->write("\t\t"+w->getPronunciation().toUtf8()+'\n'); shadowVocabFile->write("\t\n"); - shadowVocabFile->write("\t\n"); - shadowVocabFile->write("\t\t"+w->getTerminal().toUtf8()+'\n'); - shadowVocabFile->write("\t\n"); + shadowVocabFile->write("\t\n"); + shadowVocabFile->write("\t\t"+w->getCategory().toUtf8()+'\n'); + shadowVocabFile->write("\t\n"); shadowVocabFile->write("\n"); } @@ -219,9 +219,9 @@ bool ShadowVocabulary::removeWord(Word* w, bool deleteWord) } -bool ShadowVocabulary::renameTerminal(const QString& from, const QString& to) +bool ShadowVocabulary::renameCategory(const QString& from, const QString& to) { - if (Vocabulary::renameTerminal(from, to)) + if (Vocabulary::renameCategory(from, to)) return save(); return false; } diff --git a/simonlib/simonscenarios/shadowvocabulary.h b/simonlib/simonscenarios/shadowvocabulary.h index a228341..b193c03 100644 --- a/simonlib/simonscenarios/shadowvocabulary.h +++ b/simonlib/simonscenarios/shadowvocabulary.h @@ -50,7 +50,7 @@ class MODELMANAGEMENT_EXPORT ShadowVocabulary : public Vocabulary bool addWords(QList w); bool reOrder(Word* w); bool removeWord(Word* w, bool deleteWord=true); - bool renameTerminal(const QString& from, const QString& to); + bool renameCategory(const QString& from, const QString& to); bool reset(QIODevice* data); bool empty(); diff --git a/simonlib/simonscenarios/vocabulary.cpp b/simonlib/simonscenarios/vocabulary.cpp index 634af11..a050ec2 100644 --- a/simonlib/simonscenarios/vocabulary.cpp +++ b/simonlib/simonscenarios/vocabulary.cpp @@ -44,22 +44,22 @@ bool Vocabulary::deSerialize(const QDomElement& vocabularyElem) //clean member qDeleteAll(m_words); m_words.clear(); - terminals.clear(); + categories.clear(); QDomElement wordElem = vocabularyElem.firstChildElement(); while (!wordElem.isNull()) { QDomElement nameElem = wordElem.firstChildElement(); QDomElement pronunciationElem = nameElem.nextSiblingElement(); - QDomElement terminalElem = pronunciationElem.nextSiblingElement(); + QDomElement categoryElem = pronunciationElem.nextSiblingElement(); QString name = nameElem.text(); QString pronunciation = pronunciationElem.text(); - QString terminal = terminalElem.text(); + QString category = categoryElem.text(); - if (!terminals.contains(terminal)) terminals << terminal; + if (!categories.contains(category)) categories << category; - m_words << new Word(name, pronunciation, terminal); + m_words << new Word(name, pronunciation, category); wordElem = wordElem.nextSiblingElement(); } @@ -90,9 +90,9 @@ QDomElement Vocabulary::serialize(QDomDocument *doc) pronunciationElem.appendChild(doc->createTextNode(w->getPronunciation())); wordElem.appendChild(pronunciationElem); - QDomElement terminalElem = doc->createElement("terminal"); - terminalElem.appendChild(doc->createTextNode(w->getTerminal())); - wordElem.appendChild(terminalElem); + QDomElement categoryElem = doc->createElement("category"); + categoryElem.appendChild(doc->createTextNode(w->getCategory())); + wordElem.appendChild(categoryElem); elem.appendChild(wordElem); } @@ -103,7 +103,7 @@ QDomElement Vocabulary::serialize(QDomDocument *doc) bool Vocabulary::removeWord(Word* w, bool deleteWord) { - //not updating terminal cache... + //not updating category cache... for (int i=0; i < m_words.count(); i++) { if (m_words.at(i) == w) { beginRemoveRows(QModelIndex(), i, i); @@ -130,7 +130,7 @@ QVariant Vocabulary::data(const QModelIndex &index, int role) const case 1: return word->getPronunciation(); case 2: - return word->getTerminal(); + return word->getCategory(); case 3: return word->getPropability(); } @@ -229,8 +229,8 @@ bool Vocabulary::addWords(QList w) for (int i=0; i < m_words.count(); i++) { if (!( *(m_words[i]) < *(w.at(0)) )) { if (*(m_words[i]) != *(w.at(0))) { - if (!terminals.contains(w.at(0)->getTerminal())) - terminals << w.at(0)->getTerminal(); + if (!categories.contains(w.at(0)->getCategory())) + categories << w.at(0)->getCategory(); m_words.insert(i, w.takeAt(0)); if (w.isEmpty()) break; } @@ -244,8 +244,8 @@ bool Vocabulary::addWords(QList w) if (!w.isEmpty()) { foreach (Word *word, w) { - if (!terminals.contains(word->getTerminal())) - terminals << word->getTerminal(); + if (!categories.contains(word->getCategory())) + categories << word->getCategory(); m_words.append(word); } } @@ -303,9 +303,9 @@ bool Vocabulary::containsWord(const QString& word) } -bool Vocabulary::containsWord(const QString& word, const QString& terminal, const QString& pronunciation) +bool Vocabulary::containsWord(const QString& word, const QString& category, const QString& pronunciation) { - Word searchWord = Word(word, terminal, pronunciation); + Word searchWord = Word(word, category, pronunciation); foreach (Word *w, m_words) if ((*w) == searchWord) return true; @@ -313,7 +313,7 @@ bool Vocabulary::containsWord(const QString& word, const QString& terminal, cons } -QString Vocabulary::getRandomWord(const QString& terminal) +QString Vocabulary::getRandomWord(const QString& category) { if (m_words.isEmpty()) return QString(); @@ -321,12 +321,12 @@ QString Vocabulary::getRandomWord(const QString& terminal) //start at this random position for (int i=starting; i < m_words.count(); i++) - if (m_words[i]->getTerminal() == terminal) + if (m_words[i]->getCategory() == category) return m_words[i]->getWord(); //no matching word found? go backwards for (int i=starting-1; i > 0; i--) - if (m_words[i]->getTerminal() == terminal) + if (m_words[i]->getCategory() == category) return m_words[i]->getWord(); //still none? ok, there is nothing to see here... @@ -334,21 +334,21 @@ QString Vocabulary::getRandomWord(const QString& terminal) } -bool Vocabulary::renameTerminal(const QString& from, const QString& to) +bool Vocabulary::renameCategory(const QString& from, const QString& to) { foreach (Word *w, m_words) - if (w->getTerminal() == from) - w->setTerminal(to); - terminals.removeAll(from); - if (!terminals.contains(to)) - terminals << to; + if (w->getCategory() == from) + w->setCategory(to); + categories.removeAll(from); + if (!categories.contains(to)) + categories << to; return true; } -QStringList Vocabulary::getTerminals() +QStringList Vocabulary::getCategories() { - return terminals; + return categories; } @@ -415,12 +415,12 @@ QList Vocabulary::findWords(const QString& name, Vocabulary::MatchType ty * @warning: This returns a list containing shallow copies of the words of the vocabulary * Do not delete its contents! */ -QList Vocabulary::findWordsByTerminal(const QString& terminal) +QList Vocabulary::findWordsByCategory(const QString& category) { QList out; foreach (Word *w, m_words) - if (w->getTerminal() == terminal) + if (w->getCategory() == category) out.append(w); return out; diff --git a/simonlib/simonscenarios/vocabulary.h b/simonlib/simonscenarios/vocabulary.h index f35461b..5a7f8fc 100644 --- a/simonlib/simonscenarios/vocabulary.h +++ b/simonlib/simonscenarios/vocabulary.h @@ -43,7 +43,7 @@ class MODELMANAGEMENT_EXPORT Vocabulary : public QAbstractItemModel int rowCount(const QModelIndex &parent = QModelIndex()) const; protected: - QStringList terminals; //terminal cache + QStringList categories; //category cache QList m_words; virtual QVariant data(const QModelIndex &index, int role) const; @@ -80,20 +80,20 @@ class MODELMANAGEMENT_EXPORT Vocabulary : public QAbstractItemModel bool removeWord(Word* w, bool deleteWord=true); - QString getRandomWord(const QString& terminal); + QString getRandomWord(const QString& category); bool containsWord(const QString& word); - bool containsWord(const QString& word, const QString& terminal, const QString& pronunciation); + bool containsWord(const QString& word, const QString& category, const QString& pronunciation); int wordCount() { return m_words.count(); } QList getWords() { return m_words; } virtual ~Vocabulary(); - bool renameTerminal(const QString& from, const QString& to); + bool renameCategory(const QString& from, const QString& to); - QStringList getTerminals(); + QStringList getCategories(); QList findWords(const QString& name, Vocabulary::MatchType type); - QList findWordsByTerminal(const QString& terminal); + QList findWordsByCategory(const QString& category); virtual bool empty() { return (m_words.count() == 0) ; } void clear(); diff --git a/simonlib/simonscenarios/word.cpp b/simonlib/simonscenarios/word.cpp index 2da1e36..9ca9e09 100644 --- a/simonlib/simonscenarios/word.cpp +++ b/simonlib/simonscenarios/word.cpp @@ -26,7 +26,7 @@ bool isWordLessThan(Word *w1, Word *w2) if (w1->getLexiconWord() < w2->getLexiconWord()) return true; else return ((w1->getLexiconWord() == w2->getLexiconWord()) && ((w1->getPronunciation() < w2->getPronunciation()) || - ((w1->getPronunciation() == w2->getPronunciation()) && (w1->getTerminal() < w2->getTerminal())))); + ((w1->getPronunciation() == w2->getPronunciation()) && (w1->getCategory() < w2->getCategory())))); } diff --git a/simonlib/simonscenarios/word.h b/simonlib/simonscenarios/word.h index 5c103b4..4ca1a0e 100644 --- a/simonlib/simonscenarios/word.h +++ b/simonlib/simonscenarios/word.h @@ -46,7 +46,7 @@ class MODELMANAGEMENT_EXPORT Word private: QString word; //!< Saves the represented word QString pronunciation; //!< Saves all valid pronunciations of the word in Sam-Pa - QString terminal; //!< Category of the word + QString category; //!< Category of the word QString lexiconWord; public: @@ -61,14 +61,14 @@ class MODELMANAGEMENT_EXPORT Word * Contains the written word * @param QString pronunciation * The sampa notation of the pronunciation - * @param QString terminal - * Terminal the word belongs to + * @param QString category + * Category the word belongs to * */ - Word(QString word_, QString pronunciation_, QString terminal_) + Word(QString word_, QString pronunciation_, QString category_) : word(word_), pronunciation(pronunciation_), - terminal(terminal_), + category(category_), lexiconWord(word_.toUpper()) { } @@ -135,25 +135,25 @@ class MODELMANAGEMENT_EXPORT Word } /** - * @brief Getter-Method: terminal + * @brief Getter-Method: category * * @author Peter Grasch * @return QString - * Returns the terminal (category) of the word + * Returns the category (category) of the word * */ - QString getTerminal() const + QString getCategory() const { - return this->terminal; + return this->category; } /** - * \brief Setter-Method: terminals + * \brief Setter-Method: categories * \author Peter Grasch - * @param terminal The (new) terminal of the word + * @param category The (new) category of the word */ - void setTerminal(QString terminal) { - this->terminal = terminal; + void setCategory(QString category) { + this->category = category; } /** @@ -170,12 +170,12 @@ class MODELMANAGEMENT_EXPORT Word if (getLexiconWord() < w2.getLexiconWord()) return true; else return ((getLexiconWord() == w2.getLexiconWord()) && ((getPronunciation() < w2.getPronunciation()) || - ((getPronunciation() == w2.getPronunciation()) && (getTerminal() < w2.getTerminal())))); + ((getPronunciation() == w2.getPronunciation()) && (getCategory() < w2.getCategory())))); } bool operator!=(const Word& w2) const { - if ((getWord() != w2.getWord()) || (getTerminal() != w2.getTerminal()) || (getPronunciation() != w2.getPronunciation())) + if ((getWord() != w2.getWord()) || (getCategory() != w2.getCategory()) || (getPronunciation() != w2.getPronunciation())) return true; return false; @@ -183,7 +183,7 @@ class MODELMANAGEMENT_EXPORT Word bool operator==(const Word& w2) const { - return ((getWord() == w2.getWord()) && (getTerminal() == w2.getTerminal()) && (getPronunciation() == w2.getPronunciation())); + return ((getWord() == w2.getWord()) && (getCategory() == w2.getCategory()) && (getPronunciation() == w2.getPronunciation())); } /** diff --git a/simonlib/speechmodelcompilation/modelcompilationadapterhtk.cpp b/simonlib/speechmodelcompilation/modelcompilationadapterhtk.cpp index 4b59b01..58dba8b 100644 --- a/simonlib/speechmodelcompilation/modelcompilationadapterhtk.cpp +++ b/simonlib/speechmodelcompilation/modelcompilationadapterhtk.cpp @@ -306,7 +306,7 @@ bool ModelCompilationAdapterHTK::storeVocabulary(ModelCompilationAdapter::Adapti emit status(i18n("Adapting vocabulary..."), 35, 100); // find out which words are referenced by training data - // find out which terminals are referenced by grammar + // find out which categories are referenced by grammar QFile simpleVocabFile(simpleVocabPathOut); if (!simpleVocabFile.open(QIODevice::WriteOnly)) @@ -322,20 +322,20 @@ bool ModelCompilationAdapterHTK::storeVocabulary(ModelCompilationAdapter::Adapti vocabStream << "% NS_B\n\tsil\n"; vocabStream << "% NS_E\n\tsil\n"; - QStringList grammarTerminals = grammar->getTerminals(); + QStringList grammarCategories = grammar->getCategories(); bool everythingChanged = true; while (everythingChanged) { everythingChanged = false; - foreach (const QString& terminal, grammarTerminals) + foreach (const QString& category, grammarCategories) { - //if there are no words for this terminal, remove it from the list - QList wordsForTerminal = vocabulary->findWordsByTerminal(terminal); + //if there are no words for this category, remove it from the list + QList wordsForCategory = vocabulary->findWordsByCategory(category); bool hasAssociatedWord = false; - foreach (Word *word, wordsForTerminal) + foreach (Word *word, wordsForCategory) { if ((!(adaptionType & ModelCompilationAdapter::AdaptAcousticModel)) || trainedVocabulary.contains(word->getLexiconWord())) @@ -345,18 +345,18 @@ bool ModelCompilationAdapterHTK::storeVocabulary(ModelCompilationAdapter::Adapti if ((adaptionType & ModelCompilationAdapter::AdaptAcousticModel) && !(adaptionType & ModelCompilationAdapter::AdaptIndependently) && !hasAssociatedWord) { - grammarTerminals.removeAll(terminal); + grammarCategories.removeAll(category); for (int i=0; i < structures.count(); i++) { - if (structures[i].contains(QRegExp("\\b"+terminal+"\\b"))) + if (structures[i].contains(QRegExp("\\b"+category+"\\b"))) { // This appears to be a bit arbitrary and shouldn't technically be necessary. Lets // disable it for now, keep it around for a while and look for bugs. // - // //delete all words of all terminals in this structure + // //delete all words of all categories in this structure // QStringList structureElements = structures[i].split(' '); - // foreach (const QString& structureTerminal, structureElements) { - // QList wordsToDelete = vocab->findWordsByTerminal(structureTerminal); + // foreach (const QString& structureCategory, structureElements) { + // QList wordsToDelete = vocab->findWordsByCategory(structureCategory); // foreach (Word *w, wordsToDelete) // vocab->removeWord(w, true); // } @@ -376,13 +376,13 @@ bool ModelCompilationAdapterHTK::storeVocabulary(ModelCompilationAdapter::Adapti ADAPT_CHECKPOINT; - foreach (const QString& terminal, grammarTerminals) + foreach (const QString& category, grammarCategories) { //only store vocabulary that is referenced by the grammar - QList wordsForTerminal = vocabulary->findWordsByTerminal(terminal); + QList wordsForCategory = vocabulary->findWordsByCategory(category); - vocabStream << "% " << terminal << "\n"; - foreach (const Word *w, wordsForTerminal) + vocabStream << "% " << category << "\n"; + foreach (const Word *w, wordsForCategory) vocabStream << w->getWord() << "\t" << w->getPronunciation() << "\n"; } simpleVocabFile.close(); diff --git a/simonlib/speechmodelcompilation/modelcompilationadaptersphinx.cpp b/simonlib/speechmodelcompilation/modelcompilationadaptersphinx.cpp index ae215e6..6e78467 100644 --- a/simonlib/speechmodelcompilation/modelcompilationadaptersphinx.cpp +++ b/simonlib/speechmodelcompilation/modelcompilationadaptersphinx.cpp @@ -170,13 +170,13 @@ bool ModelCompilationAdapterSPHINX::storeModel(AdaptionType adaptionType, const bool ModelCompilationAdapterSPHINX::purgeUnusedVocabulary(QSharedPointer vocabulary, QSharedPointer grammar) { - QSet terminals; + QSet categories; foreach (const QString& structure, grammar->getStructures()) - foreach (const QString& terminal, structure.split(" ", QString::SkipEmptyParts)) - terminals.insert(terminal); + foreach (const QString& category, structure.split(" ", QString::SkipEmptyParts)) + categories.insert(category); QList words = vocabulary->getWords(); foreach (Word* w, words) - if (!terminals.contains(w->getTerminal())) + if (!categories.contains(w->getCategory())) vocabulary->removeWord(w); return true; } @@ -372,8 +372,8 @@ bool ModelCompilationAdapterSPHINX::storeGrammar(ModelCompilationAdapter::Adapti foreach (const QString& structure, grammarStructures) { - QStringList terminals = Grammar::getTerminalsForStructure(structure); - if(terminals.isEmpty()) + QStringList categories = Grammar::getCategoriesForStructure(structure); + if(categories.isEmpty()) continue; // if(structure != grammarStructures.first()) @@ -383,21 +383,21 @@ bool ModelCompilationAdapterSPHINX::storeGrammar(ModelCompilationAdapter::Adapti QString gramBuffer; - kDebug()<<"Terminals count for structure "< wordsForTerminal = vocabulary->findWordsByTerminal(terminal); + QList wordsForCategory = vocabulary->findWordsByCategory(category); - kDebug()<<"Words for terminal "<getLexiconWord()) && adaptionType != AdaptIndependently)//WARNING: talk about adapt independently becouse of magic continue; diff --git a/simonlib/speechmodelcompilation/modelcompilerhtk.cpp b/simonlib/speechmodelcompilation/modelcompilerhtk.cpp index 923d8ac..534fb3e 100644 --- a/simonlib/speechmodelcompilation/modelcompilerhtk.cpp +++ b/simonlib/speechmodelcompilation/modelcompilerhtk.cpp @@ -433,7 +433,7 @@ bool ModelCompilerHTK::makeTempVocab() { QFile vocab ( vocabPath ); - QString terminal; + QString category; if ( !vocab.open ( QFile::ReadOnly ) ) return false; QFile tmpVocab ( tempDir+"/tempvoca" ); @@ -452,10 +452,10 @@ bool ModelCompilerHTK::makeTempVocab() vocabEntry = vocabEntry.trimmed(); if ( vocabEntry.isEmpty() ) continue; if ( vocabEntry.startsWith ( '%' ) ) { - terminal = vocabEntry.mid ( 1 ).trimmed(); - tmpVocab.write ( '#'+terminal.toUtf8() +'\n' ); + category = vocabEntry.mid ( 1 ).trimmed(); + tmpVocab.write ( '#'+category.toUtf8() +'\n' ); - term.write ( QString::number(termid).toUtf8()+'\t'+terminal.toUtf8() +'\n' ); + term.write ( QString::number(termid).toUtf8()+'\t'+category.toUtf8() +'\n' ); termid++; } } @@ -486,7 +486,7 @@ bool ModelCompilerHTK::generateReverseGrammar() QString reverseGrammarEntry; QString grammarEntry; - QStringList terminals; + QStringList categories; QString identifier; int structureCount=0; @@ -504,9 +504,9 @@ bool ModelCompilerHTK::generateReverseGrammar() reverseGrammarEntry = grammarEntry.left(splitter+1); //reverse = "S:" - terminals = grammarEntry.mid(splitter+1).split(' '); - for (int j=terminals.count()-1; j >= 0; j--) - reverseGrammarEntry += terminals[j]+' '; + categories = grammarEntry.mid(splitter+1).split(' '); + for (int j=categories.count()-1; j >= 0; j--) + reverseGrammarEntry += categories[j]+' '; structureCount++; // reverse = "S:NS_E NOM NS_B " _______________________________________________ kde-doc-english mailing list kde-doc-english@kde.org https://mail.kde.org/mailman/listinfo/kde-doc-english