-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
121 additions
and
59 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file not shown.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
<!DOCTYPE html><html lang=en><head><meta charset=utf-8><meta http-equiv=X-UA-Compatible content="IE=edge"><meta name=viewport content="width=device-width,initial-scale=1"><link rel=icon href=/favicon.ico><title>vue-voice</title><link href=/css/app.6623fd4a.css rel=preload as=style><link href=/js/app.717d956a.js rel=preload as=script><link href=/js/chunk-vendors.d73966bc.js rel=preload as=script><link href=/css/app.6623fd4a.css rel=stylesheet></head><body><noscript><strong>We're sorry but vue-voice doesn't work properly without JavaScript enabled. Please enable it to continue.</strong></noscript><div id=app></div><script src=/js/chunk-vendors.d73966bc.js></script><script src=/js/app.717d956a.js></script></body></html> |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
const PATH_SRC = 'src/'; | ||
const PATH_DIST = 'dist/'; | ||
const fs = require('fs-extra'); | ||
|
||
fs.copy(`${PATH_SRC}assets`, `${PATH_DIST}assets`) | ||
.then(() => { | ||
console.info('[PACKAGING]::: Copying assets.'); | ||
}) | ||
.catch((err) => { | ||
if (err) return console.error(err); | ||
return true; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,3 @@ const VueVoice = { | |
}; | ||
|
||
module.exports = VueVoice; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,52 +1,48 @@ | ||
/* eslint-disable no-use-before-define */ | ||
/* eslint-disable no-undef */ | ||
|
||
import { Subject } from 'rxjs'; | ||
|
||
const SpeechRecognition = SpeechRecognition || webkitSpeechRecognition; | ||
|
||
export default class SpeechToText { | ||
recognition; | ||
|
||
result; | ||
|
||
resultSubject = new Subject(); | ||
|
||
constructor() { | ||
this.recognition = new SpeechRecognition(); | ||
this.result = 'created'; | ||
|
||
this.recognition.lang = 'en-EN'; | ||
this.recognition.interimResults = false; | ||
this.recognition.maxAlternatives = 1; | ||
|
||
this.recognition.onresult = (event) => { | ||
console.log('Event', event); | ||
|
||
const last = event.results.length - 1; | ||
this.result = event.results[last][0].transcript; | ||
|
||
console.log(`Confidence: ${event.results[0][0].confidence}`, this.result); | ||
this.resultSubject.next(this.result); | ||
}; | ||
|
||
this.recognition.onspeechend = () => { | ||
this.recognition.stop(); | ||
console.log('Speech end'); | ||
this.resultSubject.next(''); | ||
}; | ||
|
||
this.recognition.onnomatch = () => { | ||
console.log("I didn't recognise that colors."); | ||
}; | ||
|
||
this.recognition.onerror = (event) => { | ||
console.log(`Error occurred in recognition: ${event.error}`); | ||
this.resultSubject.error(`Error occurred in recognition: ${event.error}`); | ||
}; | ||
} | ||
|
||
speak() { | ||
this.recognition.start(); | ||
return this.resultSubject; | ||
} | ||
constructor() { | ||
this.recognition = new SpeechRecognition(); | ||
this.result = 'created'; | ||
this.resultSubject = new Subject(); | ||
|
||
this.recognition.lang = 'en-EN'; | ||
this.recognition.interimResults = false; | ||
this.recognition.maxAlternatives = 1; | ||
|
||
this.recognition.onresult = (event) => { | ||
console.log('Event', event); | ||
|
||
const last = event.results.length - 1; | ||
this.result = event.results[last][0].transcript; | ||
|
||
console.log(`Confidence: ${event.results[0][0].confidence}`, this.result); | ||
this.resultSubject.next(this.result); | ||
}; | ||
|
||
this.recognition.onspeechend = () => { | ||
this.recognition.stop(); | ||
console.log('Speech end'); | ||
this.resultSubject.next(''); | ||
}; | ||
|
||
this.recognition.onnomatch = () => { | ||
console.log("I didn't recognise that colors."); | ||
}; | ||
|
||
this.recognition.onerror = (event) => { | ||
console.log(`Error occurred in recognition: ${event.error}`); | ||
this.resultSubject.error(`Error occurred in recognition: ${event.error}`); | ||
}; | ||
} | ||
|
||
speak() { | ||
this.recognition.start(); | ||
return this.resultSubject; | ||
} | ||
} |