Git Product home page Git Product logo

alphabet-detector's People

Contributors

andersk avatar elifinkelshteyn avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar

alphabet-detector's Issues

Incorrect import statement in README

This doesn't work for me(currently in the reamde):

from alphabet_detector import AlphabetDetector
ad = AlphabetDetector()

Should be this way:

from alphabet_detector.alphabet_detector import AlphabetDetector
ad = AlphabetDetector()

What is masculine alphabet?

My text is:

'ÃÄÂ ÃÁÁÁÁÁÁÂÈÄÂÆ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x17.\x04 \x11\x03\x17\x19;\x11 \x11\x03!\x04\x17\x04 \x18\x04\x11/\x03\x11\x03$10.$/ \x9b\x9b\x9b\x9b\nÃÄÃ ÊÊÁÂÁÉÅÈÅÂ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x18\x11 \x11"$\x03\x0f\x11\x03\x04//\x19/\x03/$1;\x04\x03!$"0\x11\x19.$\x03\x11\x03$1 \x9b\x9b\x9b\x9b\nÃÄÄ ÂÊÊÊÁÂÂÇÆÁÄÄ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 .$ /$"\x03 \x04"\x0f\x19\x0f$\x03\x0f\x11\x03\x04.\x041\x1e$\x03\x11\x03$10.$/\x03\x9b\x03\x0f$!\x19"\x17$/\x03\x17$!\x11/\x03\x0f\x11\x03\x040\x04\x19\x0f\x11/ ÂÇÉÆÁ\x03\x03\x17$\x03\x9f\x03\x04"0$"\x19$\x03\x04 6\x11/\x03!\x04 \x18\x04\x0f$\x9bÁÁÁÁ\x03\x03\x03\x17$\x03\x9f\x03 \x11 /$\x03!\x04"$\x11 \x03\x16\x04 \x18\x04\x0f\x04\x9b\x9b\x9b\nÃÄÅ ÂÊÊÊÁÂÂÇÆÃÃÁ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x1e$6\x11. \x19\x03\x17$!\x11/\x03\x0f\x11\x03/$1/\x04 \x9b\x9b\x9b\x9b\nÃÄÆ ÂÊÊÊÁÂÂÇÆÆÅÉ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x04 .\x04\x04$\x03\x17$";\x04\x17\x04\x03\x0f\x04\x03/\x19 6\x04\x03\x9b\x03\x1e$/\x11\x03\x16\x04\x171"\x0f\x11/\x03\x0f\x11\x03/$1;\x04 \x9b\x9b\x9b\x9b\nÃÄÇ ÂÊÊÊÁÂÃÇÁÈÂÁ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x17\x19 !\x04.\x03!\x04.0\x19"/\x03 1/0$\x0f\x19$\x03\x9b\x03\x1e$.\x17\x11\x03!$\x18\x04!!\x04\x0f\x03\x181//\x11\x19" \x9b\x9b\x9b\x9b\nÃÄÈ ÂÊÊÊÁÂÄÂÁÁÂÈ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x04"0$"\x19$\x03\x16.\x04" \x19/ $\x03\x0f$/\x03/\x04"0$/\x03\x9b\x03\x17\x11.\x04 \x0f$\x03\x16.\x04" \x19/ $\x03\x0f$/\x03/\x04"0$/ ÂÂÆÉÂ\x03\x03\x17$\x03\x9f\x03\x11."\x11/0$\x03\x171\x19!\x04.\x04\x11/\x03.$ \x11.\x9bÂÂÆÉÂ\x03\x03\x17$\x03\x9f\x03\x11."\x11/0$\x03\x171\x19!\x04.\x04\x11/\x03.$ \x11.\x9b\x9b\x9b\nÃÄÉ ÂÊÊÊÁÂÄÅÇÂÄÆ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03$\x0f\x04\x19.\x03\x04!\x11.\x19 $\x03\x0f\x11\x03/$1/\x04 \x9b\x9b\x9b\x9b\nÃÄÊ ÊÈÁÂÁÁÇÂÄÆ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e$\x04-1\x19!\x03\x17\x11.\x04 \x0f$\x03\x0f\x04\x03 1"\x18\x04\x03\x9b\x03!\x04. \x19\x04"$\x03\x04\x0f$.9\x04"\x03\x11\x03$10.$/ \x9b\x9b\x9b\x9b\nÃÅÁ ÂÊÊÊÁÂÅÄÅÊÆÇ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 /\x19 6\x19$\x03\x16\x11."\x04"\x0f\x11/\x03\x0f\x11\x03!\x19.\x04"\x0f\x04\x03\x9b\x03\x04\x0f\x04 0$\x03 $+\x11/\x03!\x04.0\x19"/ ÇÉÊÄ\x03\x03\x03\x17$\x03\x9f\x03\x1e$/\x11\x03"1"\x11/\x03\x0f\x11\x03/$1;\x04\x9b\x9b\x9b\x9b\nÃÅÂ ÂÊÊÊÁÂÅÈÆÃÂÁ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x11\x0f/$"\x03\x1e$/\x11\x03\x0f\x11\x03$ \x196\x11\x19.\x04 \x9b\x9b\x9b\x9b\nÃÅÃ ÂÊÊÊÁÂÆÂÅÆÊÄ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03.$\x0f.\x19\x17$\x03"$ .\x11\x03\x0f\x04\x03/\x19 6\x04 \x9b\x9b\x9b\x9b\nÃÅÄ ÂÊÊÊÁÂÆÂÊÈÅÊ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 $/!\x04.\x03+\x19"0$\x03\x0f\x11\x03!\x11 $\x03\x9b\x03 \x11$!\x04.\x03\x17$";\x04\x17\x04\x03\x0f\x11\x03/$1/\x04 \x9b\x9b\x9b\x9b\nÃÅÅ ÂÊÊÊÁÂÆÃÅÊÈÂ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x1e$/\x11\x16\x19\x03\x1f \x11 \x11.\x03.$\x0f.\x19\x171\x11/\x03 \x04.\x0f$/$ ÆÁÉÅ\x03\x03\x03\x17$\x03\x9f\x03\x04"0$"\x19$\x037\x04"\x0f\x11. \x04\x04"\x03 \x040\x19/0\x04\x9b\x9b\x9b\x9b\nÃÅÆ ÂÊÊÊÁÂÇÂÁÄÉÁ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 .$!\x19 /$"\x03 \x04"\x0f\x19\x0f$\x03\x0f\x11\x03\x04.\x041\x1e$\x03\x9b\x03\x04"0$"\x19$\x03 \x04. $/\x03 \x04.\x0f$/$ \x9b\x9b\x9b\x9b\nÃÅÇ ÂÊÊÊÁÂÇÅÈÈÅÈ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03+\x041 $\x03\x04 6\x11/\x03\x0f\x04\x03!$0\x04\x03\x11\x03$10.$/ ÆÁÉÅ\x03\x03\x03\x17$\x03\x9f\x03\x04"0$"\x19$\x037\x04"\x0f\x11. \x04\x04"\x03 \x040\x19/0\x04\x9b\x9b\x9b\x9b\nÃÅÈ ÂÊÊÊÁÃÁÅÂÆÆÊ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x1e$\x04$\x03\x04 \x11.0$\x03 \x04.\x0f$/$\x03"1"\x11/ \x9b\x9b\x9b\x9b\nÃÅÉ ÂÊÊÊÁÂÈÄÃÉÊÃ Â\x04\x036\x04.\x04\x03 .\x19!\x19"\x04 \x16$.!$/\x04 \x1e1/0\x19 \x04\x03+1 \x19 \x04\x03\x9b\x03\x04 \x11//\x04"\x0f.$\x03.$\x0f.\x19\x171\x11/\x03\x0f\x11\x03$ \x196\x11\x19.\x04 ÂÈÂÉÊ\x03\x03\x17$\x03\x9f\x03\x04"\x0f.\x11\x03 1 \x19$\x03!\x11"\x0f\x11/\x03\x0f\x11\x03$ \x196\x11\x19.\x04\x9b\x9b\x9b\x9b\nANO XIV - EDIÇÃO Nº 3243 Suplemento - SEÇÃO I DISPONIBILIZAÇÃO: terça-feira, 01/06/2021'

Code:
ad.detect_alphabet(text)

Ouput:
{'LATIN', 'MASCULINE'}

を not detected as is_cjk

>>> alphabet_detector.is_cjk("無限")
True
>>> alphabet_detector.is_cjk("無限を分")
False
>>> alphabet_detector.is_cjk("を分")
False
>>> alphabet_detector.is_cjk("分")
True
>>> alphabet_detector.is_cjk("を")
False

Would be nice to see supported languages.

From the code I can see there are only selected languages supported. Would be nice to see what languages are supported and raise an error/warning if the langauge is not supported. Right now, a bool is returned on ENGLISH.

Not sure if by default all the languages are support. Correct me if I am wrong.

A contains function would be nice

Sometimes one would not need to iterate over the complete string, when the only thing of interest is if a string contains at least one character of a given type.

Thus a function like this would be convenient:
ad.contains_alphabet_chars(u'100 漢字', 'CJK')

I know, that the following does already work, but this will iterate over the complete string:
'CJK' in ad.detect_alphabet(u'100 漢字')

Citation file?

Hello Eli!

I would like to cite your code on a paper, if that's ok with you. Could you add a citation file so that I can do that through github's UI? Thanks!

empty string returns True

I dont know if this is a desired behavior, but when i run only_alphabet_chars on an empty string it always returns True.
Since this is no character I would expect to return None of False.

ad = AlphabetDetector()
print(ad.only_alphabet_chars('', 'LATIN'))
print(ad.only_alphabet_chars('', 'GREEK'))

A possibly better the __dict__ variable?

Hi, thanks for designing this small useful alphabet detecting package. It works good enough for me, but I noticed the ad.__dict__ instance variable. The body of this dictionary is basically of the form:

{'LATIN': {'ε': False, 'm': True, 'e': True, 'a': True, 'n': True, 's': True, 'g': True, 'r': True}}

Would it be more efficient if we store it like the following:

{'LATIN': {'m', 'g', 'k', 'e'}, 'GREEK': {'ε', 'λ', 'ά'}, 'CJK': {'你', '好'}}

I know it took its current structure because you wrapped up the discussion in a StackExchange thread, but I think as the number of queries increases, the former dictionary will be very memory consuming, while the latter should save memory and also be efficient in time?

Hope to have more discussion!

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.