Metadata-Version: 2.1
Name: pstring
Version: 1.0.2
Summary: PString is a str class that recognizes IPA symbols.
Author-email: Caio Rocha <caiocedrola@ice.ufjf.br>
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.
Keywords: ipa,phoneme,phonetics
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python
Classifier: Programming Language :: Python :: 3
Requires-Python: >=3.7
Description-Content-Type: text/markdown
License-File: LICENSE

# 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.
