GithubHelp home page GithubHelp logo

ipapy's People

Contributors

pettarin 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

Watchers

 avatar  avatar

ipapy's Issues

Update latest version to pip

Hi Alberto,

Thanks for making this great package.

Would it be possible to upload the latest version (with the fix from #2 ) to pip?
We use ipapy within wordkit. Apparently Windows users have problems installing this due to this encoding issue.

If not, then I'll add a work-around to Wordkit.

Thanks!
Stéphan

ARPABETMapper generates phones that are not part of ARPABET

The ARPABETMapper class seems to map some IPA phones to phones that are not part of ARPABET.
So far I've seen the following examples: {'EA', 'IA', 'OH', 'Q', 'UA'}

Code to reproduce:

from ipapy.arpabetmapper import ARPABETMapper
amapper = ARPABETMapper()
amapper.map_unicode_string('o' + 'ʔ', ignore=True, return_as_list=True)

# OUTPUT: ['OH', 'Q']

Failed to install on 3.6.4 on Windows 10

Tried installing this module through pip but got an installation error. Full trace:

PS C:\Users\bmvroy> pip install ipapy
Collecting ipapy
  Using cached https://files.pythonhosted.org/packages/ae/d2/1af2bf40023d0cbc5d5cb9477938b923b8dc2eae479e5f0d1b4350db72be/ipapy-0.0.8.0.tar.gz
    Complete output from command python setup.py egg_info:
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "C:\Users\bmvroy\AppData\Local\Temp\pip-install-2wtx0rh1\ipapy\setup.py", line 28, in <module>
        long_description=open("README.rst", "r").read(),
      File "c:\python\python36\lib\encodings\cp1252.py", line 23, in decode
        return codecs.charmap_decode(input,self.errors,decoding_table)[0]
    UnicodeDecodeError: 'charmap' codec can't decode byte 0x90 in position 6127: character maps to <undefined>

    ----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\bmvroy\AppData\Local\Temp\pip-install-2wtx0rh1\ipapy\

As you can see, it's an encoding error. Probably this is related to a file opening somewhere where the encoding is not explictly said to UTF-8. By default, Python uses the OS's default/the user's preferred encoding: locale.getpreferredencoding(). I will take a look later, but I already share the bug now.

Cannot import name 'MutableSequence' from 'collections' (Python 3.10)

I get the following error when I try to use IPAString in new project

from ipapy.ipastring import IPAString

if __name__ == '__main__':
    IPAString(unicode_string="tɛst")

Error:

Traceback (most recent call last):
  File "D:\dev\tes1\main.py", line 1, in <module>
    from ipapy.ipastring import IPAString
  File "D:\dev\tes1\venv\lib\site-packages\ipapy\ipastring.py", line 10, in <module>
    from collections import MutableSequence
ImportError: cannot import name 'MutableSequence' from 'collections' (C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.1776.0_x64__qbz5n2kfra8p0\lib\collections\__init__.py)

Resolution is to change ipastring.py:10:
from
from collections import MutableSequence
to
from collections.abc import MutableSequence

ipapy behaves strangely when modifing ipachar properties

Ipapy by default shares the representation of the characters which leads to strange behaviours:

s = IPAString(unicode_string=r"pæk")
s[0].voicing = 'voiced'
print(s[0].voicing) # voiced
print(s[0].canonical_representation) # bilabial consonant plosive voiceless
print(str(s)) # p
s[2].descriptors = list(map(lambda d: 'voiced' if d in DG_C_VOICING else d, s[2].descriptors))
print(s[2].voicing) # voiced
print(s[2].canonical_representation) # consonant plosive velar voiced
print(str(s)) # k
s = IPAString(unicode_string=r"pæk")
print(s[0].voicing) # voiced

It can be workaround by copying and double-lookup of characters:

s = IPAString(unicode_string=r"pæk")
s[0] = UNICODE_TO_IPA[IPA_TO_UNICODE[IPAChar(descriptors=list(map(lambda d: 'voiced' if d in DG_C_VOICING else d, s[0].descriptors))).canonical_representation]]
print(str(s)) # bæk

But this is very verbose operation for changing a single letter.

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.