public void PlayRawAudioSync(SpeechPart buffer) { queueAudios.Enqueue(buffer); if (!bw.IsBusy) { bw.RunWorkerAsync(); } }
void player_ProgressChanged(object sender, TextToSpeech.ProgressChangedEventArgs e) { SpeechPart speechPart = e.Data; rtbContent.Select(0, speechPart.TextIndex); rtbContent.SelectionColor = Color.Gray; rtbContent.Select(speechPart.TextIndex, speechPart.TextLength); rtbContent.SelectionColor = Color.Red; rtbContent.Select(speechPart.TextIndex + speechPart.TextLength, 0); }
public Word GetWord(string name, string speechPartString, Word rootWord = null) { SpeechPart speechPart = SpeechPart.NotSpecified; Enum.TryParse <SpeechPart>(speechPartString, out speechPart); return(new Word() { Name = name, SpeechPart = speechPart, RootWord = rootWord }); }
private List <ThesaurusItem> parseComponentItems(String[] words, SpeechPart speechPart, WordRel wordRel) { List <ThesaurusItem> values = new List <ThesaurusItem>(); if (words != null) { foreach (String word in words) { values.Add(new ThesaurusItem(word, speechPart, wordRel)); } } return(values); }
void tts_ProgressChanged(object sender, TextToSpeech.ProgressChangedEventArgs e) { if (this.InvokeRequired) { this.Invoke(new EventHandler <TextToSpeech.ProgressChangedEventArgs>(tts_ProgressChanged), sender, e); return; } SpeechPart speechPart = e.Data; progressBar.Maximum = speechPart.TotalCount; progressBar.Value = speechPart.TextIndex + speechPart.TextLength; player.PlayRawAudioSync(speechPart); }
void bw_DoWork(object sender, DoWorkEventArgs e) { BackgroundWorker bw = sender as BackgroundWorker; SpeechPart data = null; while (true) { if (!queueAudios.TryDequeue(out data)) { Thread.Sleep(100); continue; } bw.ReportProgress( (int)(100.0 * (data.TextIndex + data.TextLength) / data.TotalCount), data); byte[] rawAudio = data.RawAudio; int position = 0; while (true) { if (PlayBuffer.BufferedBytes > 16000 * 16 / 8 / 5) {//0.5ms Thread.Sleep(100); continue; } if (position >= rawAudio.Length) { break; } int blockSize = Math.Min(16000 * 16 / 8, rawAudio.Length - position); PlayBuffer.AddSamples(rawAudio, position, blockSize); position += blockSize; } } }
static public string PartToString(SpeechPart part) { string output = ""; if (part.HasFlag(Vocabulary.SpeechPart.Adjective)) { if (output != "") { output = output + "/"; } output = output + "Adjective"; } if (part.HasFlag(Vocabulary.SpeechPart.Adverb)) { if (output != "") { output = output + "/"; } output = output + "Adverb"; } if (part.HasFlag(Vocabulary.SpeechPart.Conjunction)) { if (output != "") { output = output + "/"; } output = output + "Conjunction"; } if (part.HasFlag(Vocabulary.SpeechPart.DefArticle)) { if (output != "") { output = output + "/"; } output = output + "DefArticle"; } if (part.HasFlag(Vocabulary.SpeechPart.IndefArticle)) { if (output != "") { output = output + "/"; } output = output + "IndefArticle"; } if (part.HasFlag(Vocabulary.SpeechPart.Interjection)) { if (output != "") { output = output + "/"; } output = output + "Interjection"; } if (part.HasFlag(Vocabulary.SpeechPart.IntransVerb)) { if (output != "") { output = output + "/"; } output = output + "Intransverb"; } if (part.HasFlag(Vocabulary.SpeechPart.Nominative)) { if (output != "") { output = output + "/"; } output = output + "Nominative"; } if (part.HasFlag(Vocabulary.SpeechPart.Noun)) { if (output != "") { output = output + "/"; } output = output + "Noun"; } if (part.HasFlag(Vocabulary.SpeechPart.Plural)) { if (output != "") { output = output + "/"; } output = output + "Plural"; } if (part.HasFlag(Vocabulary.SpeechPart.Preposition)) { if (output != "") { output = output + "/"; } output = output + "Preposition"; } if (part.HasFlag(Vocabulary.SpeechPart.Pronoun)) { if (output != "") { output = output + "/"; } output = output + "Pronoun"; } if (part.HasFlag(Vocabulary.SpeechPart.TransVerb)) { if (output != "") { output = output + "/"; } output = output + "TransVerb"; } if (part.HasFlag(Vocabulary.SpeechPart.Verb)) { if (output != "") { output = output + "/"; } output = output + "Verb"; } if (output == "") { output = "Unknown"; } return(output); }
/// <summary> /// Determine speech part /// </summary> /// <param name="speechPartName">short name of speech part</param> public void SetPartOfSpeech(string speechPartName) { switch (speechPartName) { case "subst": case "depr": this.PartOfSpeech = SpeechPart.Noun; break; case "adj": case "adja": case "adjp": this.PartOfSpeech = SpeechPart.Adjective; break; case "adv": this.PartOfSpeech = SpeechPart.Adverb; break; case "dig": case "num": this.PartOfSpeech = SpeechPart.Numeral; break; case "ppron12": case "ppron3": case "siebie": this.PartOfSpeech = SpeechPart.Pronoun; break; case "fin": case "bedzie": case "aglt": case "praet": case "impt": case "imps": case "inf": case "pcon": case "pant": case "ger": case "pact": case "ppas": case "winien": this.PartOfSpeech = SpeechPart.Verb; break; case "pred": this.PartOfSpeech = SpeechPart.Predicative; break; case "prep": this.PartOfSpeech = SpeechPart.Preposition; break; case "interj": case "conj": this.PartOfSpeech = SpeechPart.Conjuctiun; break; default: this.PartOfSpeech = SpeechPart.Other; break; } ; }
public IEnumerable <string> GetWords(SpeechPart speechPart) { return(dictionary[speechPart]); }
public Word(string value, SpeechPart speechPart) { Value = value; PartOfSpeech = speechPart; }
public bool RemoveIgnoredSpeechPart(SpeechPart speechPart) { return(ignoredSpeechParts.Remove(speechPart)); }
public bool AddIgnoredSpeechPart(SpeechPart speechPart) { return(ignoredSpeechParts.Add(speechPart)); }
public static string PartToString(SpeechPart part) { string output = ""; if (part.HasFlag (Vocabulary.SpeechPart.Adjective)) { if (output != "") { output = output + "/"; } output = output + "Adjective"; } if (part.HasFlag (Vocabulary.SpeechPart.Adverb)) { if (output != "") { output = output + "/"; } output = output + "Adverb"; } if (part.HasFlag (Vocabulary.SpeechPart.Conjunction)) { if (output != "") { output = output + "/"; } output = output + "Conjunction"; } if (part.HasFlag (Vocabulary.SpeechPart.DefArticle)) { if (output != "") { output = output + "/"; } output = output + "DefArticle"; } if (part.HasFlag (Vocabulary.SpeechPart.IndefArticle)) { if (output != "") { output = output + "/"; } output = output + "IndefArticle"; } if (part.HasFlag (Vocabulary.SpeechPart.Interjection)) { if (output != "") { output = output + "/"; } output = output + "Interjection"; } if (part.HasFlag (Vocabulary.SpeechPart.IntransVerb)) { if (output != "") { output = output + "/"; } output = output + "Intransverb"; } if (part.HasFlag (Vocabulary.SpeechPart.Nominative)) { if (output != "") { output = output + "/"; } output = output + "Nominative"; } if (part.HasFlag (Vocabulary.SpeechPart.Noun)) { if (output != "") { output = output + "/"; } output = output + "Noun"; } if (part.HasFlag (Vocabulary.SpeechPart.Plural)) { if (output != "") { output = output + "/"; } output = output + "Plural"; } if (part.HasFlag (Vocabulary.SpeechPart.Preposition)) { if (output != "") { output = output + "/"; } output = output + "Preposition"; } if (part.HasFlag (Vocabulary.SpeechPart.Pronoun)) { if (output != "") { output = output + "/"; } output = output + "Pronoun"; } if (part.HasFlag (Vocabulary.SpeechPart.TransVerb)) { if (output != "") { output = output + "/"; } output = output + "TransVerb"; } if (part.HasFlag (Vocabulary.SpeechPart.Verb)) { if (output != "") { output = output + "/"; } output = output + "Verb"; } if (output == "") { output = "Unknown"; } return output; }
public ThesaurusItem(String word, SpeechPart speechPart, WordRel wordRel) { this.Word = textInfo.ToTitleCase(word); this.SpeechPart = speechPart; this.WordRelation = wordRel; }
public PartOfSpeech(SpeechPart Part) { this.Part = Part; }
public PartOfSpeech(SpeechPart Part, List <ThesaurusItem> Items) { this.Part = Part; AddItems(Items); }