Coder Social home page Coder Social logo

broca's Introduction

Broca

A ChatGPT powered dictionary (English <-> Chinese|Spanish|Japanese|Korean|German|French|Portuguese) + vocabulary book

Broca.0.0.1.mp4

Introduction

Introducing Broca - the ultimate dictionary and vocabulary book app, powered by ChatGPT API! Have you ever struggled to keep track of English words you come across and want to learn, especially when using multiple devices? Look no further than Broca. This powerful app allows you to effortlessly organize and synchronize your vocabulary book across all of your devices.

With Broca, you can easily save words as plain JSON files in a folder, ensuring seamless synchronization across all of your devices. But that's not all. With ChatGPT as its dictionary engine, Broca is capable of searching for idioms, phrases, and slang that are not easily found in traditional dictionaries. Plus, it can generate unlimited example sentences to help you better understand the context and usage of each word.

And the name? Broca is named after the brain region responsible for language, making it the perfect name for an app designed to help you master the English language. Download Broca today and start building your vocabulary like a pro!

Installation

Prebuilt installers are available on the release page (MacOS only for now).

Usage

Screenshot 2023-04-27 at 9 45 07 PM

Firstly, create a folder to store your vocabulary book. All words will be saved to this folder, which can be found at /vocabulary. This will help you keep your vocabulary organized and easily accessible.

Secondly, it is mandatory to provide your OpenAI API key. This allows Broca to access the powerful language processing capabilities of OpenAI, which greatly enhances the app's performance and accuracy.

Thirdly, choose your target language (the language you want to translate to). At the moment, we support Chinese, Spanish, Japanese, Korean, German, French, and Portuguese.

Optionally, you can provide your AWS key and secret for pronunciation purposes. If you choose to do so, please ensure that your AWS key has full access to the AWS service Polly. This will enable Broca to accurately pronounce words for you, which can be a great help when learning a new language.

By following these simple steps, you'll be ready to start using Broca to expand your language skills and communicate with confidence.

Build

  1. Install tauri-cli. I prefer using Cargo.
cargo install tauri-cli
  1. Build
cd ./frontend
npm i
cd ../src-tauri
cargo tauri dev

Todos

  • Linux / Win support
  • Select Voice
  • More Languages

broca's People

Contributors

shi-yan avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

broca's Issues

Support more languages, and cleanup code in openai.rs

The code in openai.rs is a bit messy, it contains repetitive code to support multiple languages. This can be improved by removing repetitive part and made extensible. i.e. when adding a new language, just register a set of new translations.

runtime error

{"model":"gpt-3.5-turbo","messages":[{"role":"system","content":"You are a dictionary bot. Given a query, reply its meaning and sample sentences in English and Chinese in JSON format."},{"role":"user","content":"sentence"},{"role":"assistant","content":"[{"pos":"noun","meanings":[{"meaning":[{"English":"A set of words that is complete in itself, typically containing a subject and predicate, conveying a statement, question, exclamation, or command, and consisting of a main clause and sometimes one or more subordinate clauses."},{"Chinese":"一组单词"}],"examples":[[{"English":"The teacher ask each student to make a sentence."},{"Chinese":"老师让每个学生造一个句子。"}]]},{"meaning":[{"English":"The punishment assigned to a defendant found guilty by a court, or fixed by law for a particular offense."},{"Chinese":"法庭针对有罪的被告的惩罚。或是依法规定的惩罚。"}],"examples":[[{"English":"Her husband is serving a three-year sentence for fraud."},{"Chinese":"她丈夫增在为三年刑期服刑。"}]]}]},{"pos":"verb","meanings":[{"meaning":[{"English":"Declare the punishment decided for (an offender)."},{"Chinese":"对罪犯进行判决。"}],"examples":[[{"English":"Ten army officers were sentenced to death."},{"Chinese":"十位军官被判处死刑。"}]]}]}]"},{"role":"user","content":"hello"}]}
🛑 Status: 429 - Too many requests
thread 'main' panicked at 'called Result::unwrap() on an Err value: No config directory found.', src/state.rs:94:106
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::unwrap
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/core/src/result.rs:1112:23
4: broca::state::State::search::{{closure}}
at ./src/state.rs:94:19
5: broca::search::{{closure}}
at ./src/main.rs:81:51
6: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283:63
7: tokio::runtime::coop::with_budget
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:107:5
8: tokio::runtime::coop::budget
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:73:5
9: tokio::runtime::park::CachedParkThread::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283:31
10: tokio::runtime::context::BlockingRegionGuard::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/context.rs:315:13
11: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
12: tokio::runtime::runtime::Runtime::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/runtime.rs:304:45
13: broca::search
at ./src/main.rs:80:12
14: broca::main::{{closure}}
at ./src/main.rs:125:25
15: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
16: tauri::manager::WindowManager::run_invoke_handler
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/manager.rs:1084:5
17: tauri::window::Window::on_message
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/window.rs:1287:11
18: tauri::manager::WindowManager::prepare_ipc_handler::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/manager.rs:782:19
19: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
20: tauri_runtime_wry::create_ipc_handler::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.12.2/src/lib.rs:3124:5
21: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
22: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
23: wry::webview::wkwebview::InnerWebView::new::did_receive
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/wry-0.23.4/src/webview/wkwebview/mod.rs:102:11
24:
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.

Select voices in the config view.

The voice engine is using AWS polly. it actually has a good selection of voices. but now we are hardcoding the voice.

I think it's better to have a voice selector in the config view, this may require some frontend work, for which I'm using solidjs.

Polly has two types of voice engines, the normal engine or the neural engine. we can only allow neural voices.

crash when typing "tang ping"

🔥 Success!
💬 Response: I'm sorry, but "tang ping" is not an English word or phrase. Could you please provide me with a valid query?
thread 'main' panicked at 'called Result::unwrap() on an Err value: Error("expected value", line: 1, column: 1)', src/openai.rs:165:110
stack backtrace:
0: _rust_begin_unwind
1: core::panicking::panic_fmt
2: core::result::unwrap_failed
3: core::result::Result<T,E>::unwrap
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/core/src/result.rs:1112:23
4: broca::openai::search::{{closure}}
at ./src/openai.rs:165:53
5: broca::state::State::search::{{closure}}
at ./src/state.rs:94:99
6: broca::search::{{closure}}
at ./src/main.rs:81:51
7: tokio::runtime::park::CachedParkThread::block_on::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283:63
8: tokio::runtime::coop::with_budget
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:107:5
9: tokio::runtime::coop::budget
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/coop.rs:73:5
10: tokio::runtime::park::CachedParkThread::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/park.rs:283:31
11: tokio::runtime::context::BlockingRegionGuard::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/context.rs:315:13
12: tokio::runtime::scheduler::multi_thread::MultiThread::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/scheduler/multi_thread/mod.rs:66:9
13: tokio::runtime::runtime::Runtime::block_on
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tokio-1.27.0/src/runtime/runtime.rs:304:45
14: broca::search
at ./src/main.rs:80:12
15: broca::main::{{closure}}
at ./src/main.rs:125:25
16: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
17: tauri::manager::WindowManager::run_invoke_handler
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/manager.rs:1084:5
18: tauri::window::Window::on_message
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/window.rs:1287:11
19: tauri::manager::WindowManager::prepare_ipc_handler::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-1.2.4/src/manager.rs:782:19
20: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
21: tauri_runtime_wry::create_ipc_handler::{{closure}}
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/tauri-runtime-wry-0.12.2/src/lib.rs:3124:5
22: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
23: <alloc::boxed::Box<F,A> as core::ops::function::Fn>::call
at /opt/local/libexec/rust/src/rustc-1.68.2-src/library/alloc/src/boxed.rs:2002:9
24: wry::webview::wkwebview::InnerWebView::new::did_receive
at /Users/lili/.cargo/registry/src/github.com-1ecc6299db9ec823/wry-0.23.4/src/webview/wkwebview/mod.rs:102:11
25:
note: Some details are omitted, run with RUST_BACKTRACE=full for a verbose backtrace.
fatal runtime error: failed to initiate panic, error 5

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.