quadrismegistus / prosodic

Prosodic: a metrical-phonological parser, written in Python. For English and Finnish, with flexible language support.
http://quadrismegistus.github.io/prosodic/
GNU General Public License v3.0
277 stars 43 forks source link

even when espeak is installed, prosodic is unable to run on windows #62

Open Taira-O opened 8 months ago

Taira-O commented 8 months ago

Even if you use the source forge link to install espeak, you still get the error on windows that you are missing espeak. FYI espeak on windows does not have the file libespeak.dylib or libespeak.so

image

yglory commented 8 months ago

I met the same issue. Any clues now?

quadrismegistus commented 8 months ago

Hm, sorry you're having this issue, guys. Are you both on Windows?

yglory commented 8 months ago

Hm, sorry you're having this issue, guys. Are you both on Windows?

It's great you're here! I'm on Windows11. According to the instructions, I did the following steps:

  1. installed prosodic with pip+github.
  2. There was an error when building packages. I downloaded and installed VS_BuildTools, problem solved.
  3. I installed eSpeak.
  4. When I tried to start Prosodic, this error had been raised.
  5. I supposed I had the wrong eSpeak installation, So I downloaded and installed 'espkeedit' as well. It still didn't work. I had a bunch of discussions with several AI but found nothing. It's really appreciated if you have any clues.
quadrismegistus commented 8 months ago

I don't have a Windows machine at the moment so it's a little hard for me to test, but I just asked work and I'm going to borrow a windows laptop for a while and see what I can figure out

quadrismegistus commented 8 months ago

In the meantime, if http://prosodic.org/ can help you for your use case (it may not!), feel free to give that a whirl

yglory commented 8 months ago

Thank you for your patience.

I've managed to import the prosodic library by setting up the get_espeak_env function from langs.py. I downloaded the espeak Linux package and extracted the libespeak.so to circumvent the function's requirements, and it worked.

Here is the Python code I used:

import os

# Set the environment variable to the path of libespeak.so
os.environ["PATH_ESPEAK"] = os.path.join(os.getcwd(), "libespeak.so")
import prosodic

# Create a prosodic Text object and display its prosody
pa = prosodic.Text("shall we?")
pa.show()

However, I encountered some unexpected log messages:

⎾ building text with 2 words @ 2024-03-26 22:06:28,959
What is this phoneme? No features found for it: 蕛 @ 2024-03-26 22:06:32,030
What is this phoneme? No features found for it: 忙 @ 2024-03-26 22:06:32,030
What is this phoneme? No features found for it: 藧 @ 2024-03-26 22:06:32,070
│ found 1 cached stanzas @ 2024-03-26 22:06:33,188
⎿ 4.2 seconds @ 2024-03-26 22:06:33,188

The Text("shall we?") statement doesn't contain any Chinese characters, so I'm puzzled by these log entries. There's no need for you to go through the trouble of borrowing a Windows computer. I'am going to revert to a previous version of Prosodic that doesn't require this setup. This solution works for my needs now. Thank you again for your support!

quadrismegistus commented 8 months ago

How bizarre, thanks for reporting this! I will see if I can recreate and see what's going on but glad you were able to find a solution for now

yglory commented 8 months ago

It would be great if this could be resolved further, I'm really looking forward to version 2.0!

George111222 commented 4 months ago

The codes doesn't solve the problem, prosodic cannot parse correctly.

quadrismegistus commented 3 months ago

Hi everyone, I've spent some time on this and prosodic+espeak works for me now on Windows 11 (haven't tried others).

  1. Update prosodic:
pip install -U prosodic
  1. You'll need to install espeak-ng from https://github.com/espeak-ng/espeak-ng/releases/latest

Prosodic will look for the installed files in:

"C:\\Program Files\\eSpeak NG\\libespeak-ng.dll",
"C:\\Program Files (x86)\\eSpeak NG\\libespeak-ng.dll",
"C:\\Program Files (x64)\\eSpeak NG\\libespeak-ng.dll",
"C:\\Program Files (Arm)\\eSpeak NG\\libespeak-ng.dll",

You can also set the environment variable directly:

import os
os.environ["PATH_ESPEAK"]="C:\\my\\path\\to\\libespeak-ng.dll"
import prosodic
  1. Test it out:
import prosodic
t=prosodic.Text("goobledy gobbledy goo")
t.df

If you see an "Error: could not find mbrola.dll" error, please ignore it; it's not necessary.

I'd really appreciate if someone could test this out and see if it works for them on Windows or if any problems remain.

Thanks for your patience!

yglory commented 3 months ago

Wow! I will give it a try and report back if I have any problems. Thanks for the update!