kip
ex_cldr Core Team
I’ll shortly be launching Text, a nascent text analysis library.
Current functionality
In this early version (not ready for prime time) it includes:
- Word counting
- N-gram generation
- Language detection (of about 250 languages with pluggable vocabularies and pluggable correlation models)
- An English inflector (singular to plural) using a non-regex algorithmic approach
Future functionality
-
A language stemmer - as soon as I finishing writing the snowball compiler
-
Parts of speech tagger
Collaboration encouraged
-
Contributions in all areas are most welcome
-
Non-english speakers who would like to contribute to non-english inflectors are particularly welcome
Next steps
After some polishing this weekend I will publish a version to hex.
Trending in Announcing
You may know https://ui.shadcn.com/, a UI component library for React. I really love it’s design style and components. I’ve built some co...
New
Hey everyone!
Req is an HTTP client for Elixir that I’ve been working on for quite some time. There is already a lot of HTTP clients out...
New
Samly can be used to enable SAML 2.0 Single Sign On in a Plug/Phoenix application.
This library uses Erlang esaml to provide
plug enabl...
New
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
offset-based pagination with...
New
The repo is at GitHub - cyberchitta/openai_ex: Community maintained Elixir library for OpenAI API · GitHub.
Docs are at OpenaiEx User Gu...
New
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
The Chelekom project is a library of Phoenix and LiveView components generated via Mix tasks to fit developer needs seamlessly.
One of i...
New
Other Trending Topics
I am seeing a lot of aplications of Argumentum ad Vericundiam in software discussions. They do link some piece of writing and point us to...
New
Hey folks,
I just published a post about Hologram’s funding and where the project goes next - the short version:
Curiosum as Main Spons...
New
Fly’s CEO posted this recently - Turn And Face The Strange · The Fly Blog
It says that Fly is going all-in on sprites, which is a worry ...
New
We’re evaluating API mocking tools for OpenAPI-based projects and would love to hear what other teams are using.
We’re particularly inte...
New
Today we’re releasing Oban for Python. Not an Oban client in Python. Not a pythonx wrapper embedded in Elixir. Nope, it’s a fully operati...
New
I was thinking since Goatmire Elixir turned out pretty good I should maybe do another one. 30th of Sep - 2nd of Oct this year./
The firs...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #deployment
- #library
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #channels
- #elixirconf
- #exunit
- #discussion
- #code-sync
- #javascript
- #podcasts
- #onsite
- #dialyzer
- #docker
- #authentication
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #ecto-query
- #elixir-ls
- #blog-post
- #ai
- #phoenix_html
- #iex
- #elixirconf-us
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #distillery
- #processes
- #api
- #forms
- #hex
- #security
- #metaprogramming










Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
kip
Based on the positive feedback it seems this project has merit. I didn’t get finished all the work I planned for the weekend but I’m clearing a backlog so I can give this project some greater attention. The inflector is finished (nouns, pronouns, verbs). I’ve started work on adding the Metaphone 2 algorithm but its a slow slog because there is no description of the algorithm I can find - just imperative code. And then some more testing and verification on language detection.
All in all, likely a one week delay.
kip
Thought I’d share the near term roadmap in a little more detail. Feedback is most definitely welcome on the capabilities you would find most useful. Or any areas you’d like to contribute to.
Step 1: Language recognition
Most natural language processing is language dependent. So identifying the source language is important. The primary way of identifying languages is to split the text into n-grams and then perform various statistical analysis of the source text versus the same analysis of a standard corpora in multiple different languages. The Universal Declaration of Human Rights is a standard text published in a lot of languages so this is the corpora I’m using. There are different ways to correlate source text versus a corpora. I am primarily using the algorithms in Language Identification from Text Using N-gram Based Cumulative Frequency Addition.
This is the due now for delivery on 28th June.
Step 2: Text segmentation
No matter what analysis is required, segmenting the text into grapheme clusters, words and sentences is required. This is very language dependent. Elixir’s
String.graphemes/1implements the Unicode segmentation algorithm for grapheme clusters so thats taken care of. Elixir’sString.split/1implements the Unicode segmentation algorithm for words.String.split/1is great for a default case but its not sufficient for language-specific segmentation. And we still need sentence segmentation too. Therefore I am implementing the CLDR Segmentation rules which provide language-specific customisation for text segmentation. This is another rules parser (I think so far I have implemented 8 different rules parsers and “compilers” in various parts of the ex_cldr project).The text segmentation algorithms will be implemented as part of the unicode_string library.
Step 3: Parts of Speech Tagging
Now we have segments of text we can proceed to understanding what is being expressed. The starting point for this is called “parts of speech tagging”. Because I want a good native Elixir implementation that supports a wide variety of languages with good (but not necessarily the absolutely best) tagging I’m using A Rule-based Part-of-Speech and Morphological Tagging Toolkit which provides a fully trained corpora for ~90 languages using the open source data maintained in the Universal Dependencies treebanks. The trained models are maintained in the RDRPOSTagger project which also defines a rules engine that I will implement in Elixir. Another parser/compiler
Step 4: Sentiment Analysis
Now that we have a grammatical breakdown of the target source we can start to identify meaning. Wikipedia says:
The implementation approach is not yet defined and feedback and suggestions are warmly welcomed.
Step 5
To be determined. It will take a 2-4 months to get through the first 4 steps so thats plenty of time for feedback and collaboration
kip
text version 2.0 has been published today, just on schedule. In addition the library text_corpus_udhr is also published today - it provides a corpus to support natural language detection.
Language Detection
textcontains 3 language classifiers to aid in natural language detection. However it does not include any corpora; these are contained in separate libraries. The available classifiers are:Text.Language.Classifier.CommulativeFrequencyText.Language.Classifier.NaiveBayesianText.Language.Classifier.RankOrderAdditional classifiers can be added by defining a module that implements the
Text.Language.Classifierbehaviour.The library text_corpus_udhr implements the
Text.Corpusbehaviour for the United National Declaration of Human Rights which is available for download in 423 languages from Unicode.Examples:
Word Counting
textcontains an implementation of word counting that is oriented towards large streams of words rather than discrete strings. Input toText.Word.word_count/2can be aString.t,File.Stream.torFlow.tallowing flexible streaming of text.English Pluralization
textincludes an inflector for the English language that takes an approach based upon An Algorithmic Approach to English Pluralization. See the moduleText.Inflect.Enand the functions:Text.Inflect.En.pluralize/2Text.Inflect.En.pluralize_noun/2Text.Inflect.En.pluralize_verb/1Text.Inflect.En.pluralize_adjective/1N-Gram generation
The
Text.Ngrammodule supports efficient generation of n-grams of length2to7. SeeText.Ngram.ngram/2.Language detection accuracy
Detection accuracy is reliable at text lengths of 150 characters or more, reasonable at 100 characters and may not be considered acceptable at shorter lengths.
The results are consistent for the range of tested languages with German being a clear exception where the results are unacceptable for now.
Further details are contained in the github repo in the
analysisdirectory.English language with Naive Bayesian classifier
Text.Language.detect/2withclassifier: Text.Classifier.NaiveBayesianand three different vocabularies.Accuracy for German language detection
German is an exception to the consistent accuracy of most languages and the results are poor. Further analysis is required to understand the underlying cause.
josefrichter
How can I do that?
ondrej-tucek
I would say that you have to create PR in kipcole9/text_corpus_udhr where you put a file, e.g.
corpus/udhr/udhr_cze.txtwith translation of udhr_eng.txt.josefrichter
Seems to be there already, right? text_corpus_udhr/corpus/udhr/udhr_ces.txt at master · kipcole9-legacy/text_corpus_udhr · GitHub
kip
Thanks for the interest! Language detection should work at an acceptable level for ~200 languages using the UDHR corpus. Of course you can also contribute additional corpora in a library of your own making as long as it has a module that implements the
Text.Corpusbehaviour.Inflection - specifically pluralisation - is on a per-language basis. If you would like to contribute an inflector then a PR with a module called
Text.Inflect.<BCP47 language code>that implements a function calledpluralize/2would be “all” thats required. I will define aText.Inflectionbehaviour in the0.3.0release to make this more clearly defined.ondrej-tucek
Mea culpa, I was looking for that file but obviously not successfully…
kip
Nothing to apologise for. I need to add a Contributing section to the docs - thankis for the prompt to do so
smolcatgirl
I think this is cool but i dont have a usecase for it. Keep up the good work