Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Long format patterns #44

Draft
wants to merge 22 commits into
base: dev
Choose a base branch
from
Draft

Long format patterns #44

wants to merge 22 commits into from

Conversation

JPapir
Copy link
Collaborator

@JPapir JPapir commented Nov 13, 2024

This branch introduces experimental support for long-format patterns (closes #43) in export. It is a major step towards introducing overabundance in downstream scripts.

So far, this has been implemented only for dynamic alignment. It makes the code much simpler in several aspects.

Checklist:

  • @XachaB : do you think this approach is reasonable? Can I extend it everywhere?
  • Add microclass computation
  • Generalize to other pattern computations OR remove other pattern computations
  • Use long format patterns in entry for entropy.
  • Use long format patterns in entry for all scripts.
  • Strong memory improvements with a categorical dtype for cell and lexeme (had some side effects: I needed to recreate merged columns in a better way, so I introduced a Paradigms class to handle this)

EDIT: removed useless dependency on #37.

EDIT 2: for the doc, the underlying data structure is now the following

lexeme,cell_x,form_x,cell_y,form_y,pattern
ab_11566,ill.pl,ɑˀ b ʒ i ,ela.pl,ɑˀ b ʃ t i ,[+voic] ⇌ [-voic]t / X+_i?
abbõnd_11569,ill.pl,ɑˀ bː i nʲ i ʒ ,ela.pl,ɑˀ bː i nʲ i s t ,ʒ ⇌ st / X+[-str -low -pre -tri]_
abbõndajāji_11570,ill.pl,ɑˀ bː ɯ n d ɑ j ɑː j i ʒ i z ,ela.pl,ɑˀ bː ɯ n d ɑ j ɑː j i ʒ i s t ,[+voic] ⇌ [-voic]t / X+_i?
abbõnz_11571,ill.pl,ɑˀ bː i nʲ i ʒ ,ela.pl,ɑˀ bː i nʲ i s t ,ʒ ⇌ st / X+[-str -low -pre -tri]_
abesīv_11573,ill.pl,ɑ b e sˑ i lʲ i ʒ ,ela.pl,ɑ b e sˑ i lʲ i s t ,ʒ ⇌ st / X+[-str -low -pre -tri]_
ābets_11574,ill.pl,ɑː b e t s i ʒ ,ela.pl,ɑː b e t s i s t ,ʒ ⇌ st / X+[-str -low -pre -tri]_

Almost everything relies on this single class. A column "applicable" can be added with the list of applicable patterns. Most often, x and y are unoriented, but for entropy, I duplicate the table and x corresponds to the predictor / y to the target.

It is incredibly easy to manipulate with groupby/apply, compared to the previous data structure.

When we store paradigms in non-human readable way, it looks like this:

form_x,form_y,pattern
1,3,s ⇌  / ssp_ <1>
5,7,s_ ⇌ _p / p_s_ <2>
8,10,s_ ⇌ _p / p_s_ <2>
18,11,None
1,13,ss_ ⇌ _s / _p_s <1>

Notice how we use the form_id to spare some memory by reducing redundant info (lexeme/cell)

@JPapir JPapir added the enhancement New feature or request label Nov 13, 2024
@JPapir JPapir requested a review from XachaB November 13, 2024 07:36
@JPapir JPapir force-pushed the feature-long-format-patterns branch from 722d886 to 712a8f4 Compare November 13, 2024 07:38
@JPapir JPapir linked an issue Nov 13, 2024 that may be closed by this pull request
@JPapir JPapir added the question Further information is requested label Nov 16, 2024
- As we now use long tables, we need to be more memory efficient. We use the category dtype for cells and lexemes.
- This required in turn some improvements in how merging and unmerging is handled (otherwise the categories were lost). Hence, I created a Paradigms class and rewrote the unmerging function to make them more efficient.
@XachaB
Copy link
Owner

XachaB commented Dec 17, 2024

Ok, this one is next on my list !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request question Further information is requested
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Patterns] Switching to long-format patterns
2 participants