Comments (4)
Hi!
Did you follow the example I posted in the other issue? Can you tell me the steps you followed so far?
After creating a file in the providers folder as I explained there, you have to write a function to pull the examples from the file.
You can copy the from_tatoeba function in tr.py, changing just the filename to get a file like this:
import os
from typing import List
import csv
import re
from .. import consts
def from_tatoeba(word: str) -> List[str]:
word = word.lower()
pattern = re.compile(f"\\b{re.escape(word)}\\b")
matches = []
try:
with open(
os.path.join(consts.VENDOR_DIR, "jpn_sentences.tsv"),
encoding="utf-8",
newline="",
) as f:
reader = csv.reader(f, delimiter="\t")
for row in reader:
sentence = row[2]
if pattern.search(sentence):
matches.append(sentence)
except FileNotFoundError:
pass
return matches
NAME = "Japanese"
PROVIDERS = [from_tatoeba]
The jpn_sentences.tsv
used here must be inside the providers/vendor
folder.
The zip files you download from https://tatoeba.org/en/downloads should be extracted to get the .tsv files.
from anki-incontext.
Oh you're right, I'd already received your answer in the other post...Will try and get back to you :D
from anki-incontext.
An update on this: I've made the Tatoeba fetcher support more languages. You can download the new release from here: https://github.com/abdnh/anki-incontext/releases/tag/0.1
You only have to put the *.tsv file under the user_files/tatoeba folder for the add-on to pick it up now. Currently supported languages are listed here. I plan to make it so that it supports all Tatoeba languages automatically in the near future.
from anki-incontext.
This is working for Spanish with downloaded Tatoeba sentences. I tried making Spanish work with Glosbe and Tatoeba without the downloaded sentences, but it didn't work (but I just added "es" to the supported languages in glosbe.py and tatoeba.py .
In facto, Glosbe and Tatoeba (without database) is not working for English either (I'll open a new issue).
from anki-incontext.
Related Issues (15)
- Fetching sentences from a deck or list of sentences? HOT 1
- Support Oxford Dictionaries API
- Support Dictionary.com
- Support Oxford Learner's Dictionaries API
- 'Ui_Dialog' object has no attribute 'gridLayout' HOT 2
- Explore using the GPT model for sentence generation
- Glosbe and Tatoeba (online) not working HOT 1
- A few suggestions HOT 1
- Rework the sentence storage format
- Improve support for multiple languages
- Add support for more languages and providers HOT 3
- Add a way to refresh the displayed sentence in review
- Skell downloader not found HOT 2
- Remove/Rework Lexico.com provider
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from anki-incontext.