pstring


Namepstring JSON
Version 1.0.2 PyPI version JSON
download
home_page
SummaryPString is a str class that recognizes IPA symbols.
upload_time2023-09-22 18:38:59
maintainer
docs_urlNone
author
requires_python>=3.7
licenseMIT License Copyright (c) [2023] [Caio Rocha] Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords ipa phoneme phonetics
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # PString

PString is a Python package for working with IPA (International Phonetic Alphabet) symbols in strings. It addresses issues where standard Python string operations may not work as expected with IPA symbols, such as iterating over a string and accessing a symbol by its index. This happens because Python interprets some phonemes as multiple individual chars when dealing with standard strings.

## Installation

You can install PString using pip:

```bash
pip install pstring
```

Make sure you have the required Python version and any dependencies installed.

## Usage

Example:
```
from PString import PString

text = "bõ d͡ʒiɐ"
phones = PString(text)

print(f"{text}")
print(f"{phones}")
```

Output:
```
bõ d͡ʒiɐ
bõ d͡ʒiɐ
```

You can iterate over a PString and also create a list of phonemes:
```
for phone in phones:
    print(phone)

print(f"str list: {list(text)}")
print(f"PString list: {list(phones)}")
```

Output:
```
b
õ

d͡ʒ
i
ɐ
str list: ['b', 'õ', ' ', 'd', '͡', 'ʒ', 'i', 'ɐ']
PString list: ['b', 'õ', ' ', 'd͡ʒ', 'i', 'ɐ']
```

You can also access a specific position or slice of the PString:
```
print(phones[3])
print(phones[3:6])
```

Output:
```
d͡ʒ
d͡ʒiɐ
```

If you wish to convert a PString back to a str:
```
phones_string = phones.to_string()
print(phones_string)
print(phones_string == text)
```

Output:
```
bõ d͡ʒiɐ
True
```

## Disclaimer

This package should represent IPA symbols listed on [IPA symbols with Unicode decimal and hex codes](https://www.internationalphoneticalphabet.org/ipa-charts/ipa-symbols-with-unicode-decimal-and-hex-codes/). Any incompatibilities of encoding are not of the author's responsibility.

## License

This package is distributed under the MIT license. See the LICENSE file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "",
    "name": "pstring",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "ipa,phoneme,phonetics",
    "author": "",
    "author_email": "Caio Rocha <caiocedrola@ice.ufjf.br>",
    "download_url": "https://files.pythonhosted.org/packages/a1/8b/62c65cc15ef95a2c65e38ce555102ee9add86c702002a858ee511fda5f4b/pstring-1.0.2.tar.gz",
    "platform": null,
    "description": "# PString\n\nPString is a Python package for working with IPA (International Phonetic Alphabet) symbols in strings. It addresses issues where standard Python string operations may not work as expected with IPA symbols, such as iterating over a string and accessing a symbol by its index. This happens because Python interprets some phonemes as multiple individual chars when dealing with standard strings.\n\n## Installation\n\nYou can install PString using pip:\n\n```bash\npip install pstring\n```\n\nMake sure you have the required Python version and any dependencies installed.\n\n## Usage\n\nExample:\n```\nfrom PString import PString\n\ntext = \"b\u00f5 d\u0361\u0292i\u0250\"\nphones = PString(text)\n\nprint(f\"{text}\")\nprint(f\"{phones}\")\n```\n\nOutput:\n```\nb\u00f5 d\u0361\u0292i\u0250\nb\u00f5 d\u0361\u0292i\u0250\n```\n\nYou can iterate over a PString and also create a list of phonemes:\n```\nfor phone in phones:\n    print(phone)\n\nprint(f\"str list: {list(text)}\")\nprint(f\"PString list: {list(phones)}\")\n```\n\nOutput:\n```\nb\n\u00f5\n\nd\u0361\u0292\ni\n\u0250\nstr list: ['b', '\u00f5', ' ', 'd', '\u0361', '\u0292', 'i', '\u0250']\nPString list: ['b', '\u00f5', ' ', 'd\u0361\u0292', 'i', '\u0250']\n```\n\nYou can also access a specific position or slice of the PString:\n```\nprint(phones[3])\nprint(phones[3:6])\n```\n\nOutput:\n```\nd\u0361\u0292\nd\u0361\u0292i\u0250\n```\n\nIf you wish to convert a PString back to a str:\n```\nphones_string = phones.to_string()\nprint(phones_string)\nprint(phones_string == text)\n```\n\nOutput:\n```\nb\u00f5 d\u0361\u0292i\u0250\nTrue\n```\n\n## Disclaimer\n\nThis package should represent IPA symbols listed on [IPA symbols with Unicode decimal and hex codes](https://www.internationalphoneticalphabet.org/ipa-charts/ipa-symbols-with-unicode-decimal-and-hex-codes/). Any incompatibilities of encoding are not of the author's responsibility.\n\n## License\n\nThis package is distributed under the MIT license. See the LICENSE file for details.\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) [2023] [Caio Rocha]  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.",
    "summary": "PString is a str class that recognizes IPA symbols.",
    "version": "1.0.2",
    "project_urls": null,
    "split_keywords": [
        "ipa",
        "phoneme",
        "phonetics"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "57267050814e42c0d6e70ab9d2441e4e268a71705a96cf609636a1c6b75d9e6c",
                "md5": "0f025f3dc2ad4eafbe0fa3c37427d00c",
                "sha256": "cd5ba718ee3dab4f8d63d47e0463d5c726bdf249f36ddd6c0269e28197320d8f"
            },
            "downloads": -1,
            "filename": "pstring-1.0.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "0f025f3dc2ad4eafbe0fa3c37427d00c",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 4546,
            "upload_time": "2023-09-22T18:38:57",
            "upload_time_iso_8601": "2023-09-22T18:38:57.443054Z",
            "url": "https://files.pythonhosted.org/packages/57/26/7050814e42c0d6e70ab9d2441e4e268a71705a96cf609636a1c6b75d9e6c/pstring-1.0.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "a18b62c65cc15ef95a2c65e38ce555102ee9add86c702002a858ee511fda5f4b",
                "md5": "210cc86027d90fd7e90047b88714d031",
                "sha256": "a8843c499997877697a34e10c1c2f7081788db470e44655ce60a2bf239942820"
            },
            "downloads": -1,
            "filename": "pstring-1.0.2.tar.gz",
            "has_sig": false,
            "md5_digest": "210cc86027d90fd7e90047b88714d031",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 4014,
            "upload_time": "2023-09-22T18:38:59",
            "upload_time_iso_8601": "2023-09-22T18:38:59.937857Z",
            "url": "https://files.pythonhosted.org/packages/a1/8b/62c65cc15ef95a2c65e38ce555102ee9add86c702002a858ee511fda5f4b/pstring-1.0.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-09-22 18:38:59",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "pstring"
}
        
Elapsed time: 0.12538s