Giter VIP home page Giter VIP logo

Comments (7)

ThoreBor avatar ThoreBor commented on August 22, 2024 1

This works for me:
return [w.strip() for w in re.split(r'[\n,,#%&$/ ]', s, re.M)]
Turns out that in a regular expression, you need to specify that you're in multiline mode
Hope this helps.

from cc-cedict-for-anki.

camerooncameroon avatar camerooncameroon commented on August 22, 2024 1

Works great! Thanks! now it's possible to mass-add new cards from lists made in many other programs

from cc-cedict-for-anki.

ThoreBor avatar ThoreBor commented on August 22, 2024

Sure, I'll add it in the next update, but I don't know when this will be. If you want to add it yourself on your end, you can just add your separators in this line in the meantime.

from cc-cedict-for-anki.

camerooncameroon avatar camerooncameroon commented on August 22, 2024

@ThoreBor
Thanks, great!
Tried \n for new line, it didn't work. How to add new line feed to the separators?
Tabs worked when I just added it to the string (literally just hit 'tab' button on my keyboard).
Space also worked (the self space, after hitting the keyboards 'space bar').

I only didn't find how to add the new line feed for word lists like:
**
美国
德国
俄国
法国
英国
日本
...
Here (and in text editors) it looks like multiline text (which it actually is), but in the addon search field it's shown as a single line with some hidden separators which is new line feeds:

image

But when I copy this new line feed sign and paste it to this string:
31 return [w.strip() for w in re.split(r'[,,#%&$/ ]', s)]
the line is broken into two lines:
31 return [w.strip() for w in re.split(r'[,,#%&$/
]', s)]
and addon shows error.

What symbol should be added to this string in the main.py file for the addon to render new line feeds signs as input search words separators?

from cc-cedict-for-anki.

ThoreBor avatar ThoreBor commented on August 22, 2024

Great! I'll add this to the next version then, as it might be useful for other people as well.

from cc-cedict-for-anki.

camerooncameroon avatar camerooncameroon commented on August 22, 2024

I only added tab to your line for tab-fans ))
This resulted in:
return [w.strip() for w in re.split(r'[\n,,#%&$/ ]', s, re.M)]

from cc-cedict-for-anki.

camerooncameroon avatar camerooncameroon commented on August 22, 2024

@ThoreBor

Actually the search method you implemented is so awesome I wish Anki had it as built-in option in Anki's own search dialog.

Of course the already present in Anki search regexp is powerful and can do almost everything - but your natural and intuitive search, where you can just copy-paste and instantly have your desired words filtered (without preformatting of the query) - is much more simple, even for people who aren't even aware of regexps )).

can your implementation be also applied to the Anki's own search dialog? as a built-in option or an addon?

from cc-cedict-for-anki.

Related Issues (20)

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.