Skip to main content

LOANPY

loanpy
Build Status

loanpy is a tool for historical linguists. It extracts sound changes and constraints from etymological dictionaries, generates pseudo-roots of L1, pseudo- sound substituted forms of L2, searches for matches and ranks them according to semantic similarity.

Installation

Type cmd into the search bar, open Command Prompt and type:

$ python -m pip install loanpy

Getting started

Change your working directory:

>>> import os
>>> os.chdir(lp.__file__[:-(len("\loanpy.py"))]+r"\data")

Get the path of your new working directory:

>>> import os
>>> print(str(os.getcwd())[:-(len("\loanpy.py"))]+r"\data")

Download pretrained vectors (3 Gigabyte) and save them to your new working directory. This step is needed to enable sorting phonetic matches according to their semantics. You can use your own vectors as well but make sure to name them "GoogleNews-vectors-negative300.bin".

Start python and type:

>>> from loanpy import loanpy as lp
>>> import pandas as pd

Define your input file.
loanpy comes with a csv generated from the annex of Gábor Zaicz's Hungarian etymological dictionary from 2006
If you use your own csv make sure to keep the same column names as in zaicz_in.csv

>>> myinput = pd.read_csv("zaicz_in.csv",encoding="utf-8")

Filter your input according to year and/or origin. E.g. if you want to keep only words of unknown origin that appear in texts before 1600 tpye:

>>> myinput=myinput[myinput.year <= 1600]
>>> myinput=myinput[myinput.origin == "G) ISMERETLEN EREDETŰ SZAVAK "]

Type in the timelayer in which you want to search for loans ("U" for Proto-Uralic, "FU" for Proto-Finno-Ugric or "Ug" for Proto-Ugric) and view your results in bestof[timelayer].csv (e.g. bestofUg.csv)

>>> lp.loandf("Ug",myinput)

Other functions

Get phonetic matches and their semantic similarity score for a single word. Output is not sorted.
(Use "n" for nouns, "v" for verbs, "a" for adjectives and "r" for everything else)

>>> import epitran
>>> epi = epitran.Epitran('hun-Latn')
>>> lp.loan(layer="Ug",wordipa=epi.transliterate("bor"),en="wine",word="bor",pos_hun="n")

Get phonetic matches without a semantic similarity score.

>>> import epitran
>>> epi = epitran.Epitran('hun-Latn')
>>> lp.loan_nosem(layer="Ug",wordipa=epi.transliterate("bor"),en="wine",word="bor",pos_hun="n")

Get semantic similarity of two words.

>>> lp.semsim("wine","beer","n","n")

Delete duplicate word pairs by keeping only the ones with the most likely reconstructed root

>>> inputfile=pd.read_csv("bestofUg.txt",encoding="utf-8")
>>> lp.delbynse(inputfile)

Add all other words from the etymological dictionary that exhibit the same sound changes

>>> inputfile=pd.read_csv("bestofUg.txt",encoding="utf-8")
>>> lp.addexamples(inputfile)

Get a list of pseudo-roots

>>> import epitran
>>> epi = epitran.Epitran('hun-Latn')
>>> lp.settimelayer("U")
>>> lp.structure(lp.shuffle(lp.posy(epi.transliterate("bor"))))

License

Academic Free License (AFL) (Creative Commons Attribution 4.0 International)

Metadata

Release files for loanpy 0.1.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for loanpy 0.1.4
File Size Uploaded
loanpy-0.1.4.tar.gz 457.7 kB Details

Release files / loanpy-0.1.4.tar.gz

Download URL loanpy-0.1.4.tar.gz
Size 457.7 kB
Tags Source
SHA-256 checksum
How to use checksums
b010ca6cb9a7e53a502df620cd36b7846c2fd2941f6e65ec3d3d1aaa85086f1d
BLAKE2b-256 checksum
How to use checksums
f70eb677053e289a7f6244615f35106e2a9503a5b20f30eaed8a964911bb5f00
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.2.0 pkginfo/1.5.0.1 requests/2.23.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.43.0 CPython/3.8.1

Release history Release notifications | RSS feed

3.0.4

1 release file

3.0.3

1 release file

3.0.2

1 release file

3.0.1

2 release files

3.0.0

1 release file

2.0.2

1 release file

2.0.1

1 release file

2.0.0

1 release file

1.0.1

2 release files

0.1.9

2 release files

0.1.8

1 release file

0.1.7

1 release file

0.1.5

1 release file

This release

0.1.4 This release

1 release file

0.1.2

1 release file

0.1.1

1 release file

0.1.0

1 release file

0.0.9

1 release file

0.0.8

1 release file

0.0.7

1 release file

0.0.6

1 release file

0.0.5

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page