phonemizer 0.4.1 → 0.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/CHANGELOG.md +10 -0
- data/README.md +29 -0
- data/bin/phonemize +33 -2
- data/lib/phonemizer/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 743ccbc91d44a630e0b5b616a069e4dbe8c3846707f5c0419fa1fc2baa26e870
|
|
4
|
+
data.tar.gz: 989de475ada3c379735bdd592bef6f6bf5d1316c2fa8d0305ae375117b35e896
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: e157e3843dc4806928beec305a31be567869ca2705210911bc59207c2e5b877fb51656d5c3851489fd33829bc672abeb293e83708d3557a0539cdda4207fe06e
|
|
7
|
+
data.tar.gz: b9ee747867c19563d7b0eacd223985cb237067371d26aeee87f2575852dca097352c460a1dce242c6df3406d5386d16dc31df91cd774a8302e276d46762302d5
|
data/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## 0.5.0 - 2026-11-18
|
|
4
|
+
|
|
5
|
+
- Add option flags to the `phonemize` executable — `-l/--language`, `-p/--phone-sep`, `-w/--word-sep`, `-s/--[no-]strip-stress`, `-k/--keep-language-switch`, `-j/--workers`, `-h/--help` — forwarded as keyword options to `Phonemizer.phonemize`; document command-line usage in README
|
|
6
|
+
- Bump version to 0.5.0
|
|
7
|
+
|
|
8
|
+
## 0.4.1 - 2026-11-18
|
|
9
|
+
|
|
10
|
+
- Add file handling to the `phonemize` executable: a file path argument is phonemized line by line (747f019 "Add file handling for phonemization input")
|
|
11
|
+
- Bump version to 0.4.1
|
|
12
|
+
|
|
3
13
|
## 0.4.0 - 2026-11-17
|
|
4
14
|
|
|
5
15
|
- Fix `phonemize` executable: `require "phonemizer"` and call `Phonemizer.phonemize` so the bin actually loads (fef5376 "Fix executable")
|
data/README.md
CHANGED
|
@@ -80,6 +80,35 @@ Phonemizer.phonemize("le célèbre Schwarzenegger", language: "fr-fr", language_
|
|
|
80
80
|
```
|
|
81
81
|
|
|
82
82
|
|
|
83
|
+
Command line
|
|
84
|
+
----------------------------------------------------------------
|
|
85
|
+
|
|
86
|
+
The `phonemize` executable exposes the same options as flags. Pass text as arguments, or a file path to phonemize it line by line:
|
|
87
|
+
|
|
88
|
+
```bash
|
|
89
|
+
phonemize "hello world"
|
|
90
|
+
phonemize -l fr-fr "les amis"
|
|
91
|
+
phonemize -l fr-fr words.txt > words.ipa
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
phonemize --help
|
|
96
|
+
# Usage: phonemize [options] [text | file]
|
|
97
|
+
# -l, --language LANG espeak voice (default: en-us)
|
|
98
|
+
# -p, --phone-sep SEP separator between phones (default: none)
|
|
99
|
+
# -w, --word-sep SEP separator between words (default: space)
|
|
100
|
+
# -s, --[no-]strip-stress strip stress marks and liaison hyphens (default: yes)
|
|
101
|
+
# -k, --keep-language-switch keep inline (en)/(fr) language tags (default: remove)
|
|
102
|
+
# -j, --workers N parallel espeak-ng calls (default: CPUs - 1)
|
|
103
|
+
# -h, --help show this help
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
```bash
|
|
107
|
+
phonemize -l fr-fr -p " " tableau
|
|
108
|
+
# => t a b l o
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
|
|
83
112
|
Punctuation
|
|
84
113
|
----------------------------------------------------------------
|
|
85
114
|
|
data/bin/phonemize
CHANGED
|
@@ -1,11 +1,42 @@
|
|
|
1
1
|
#!/usr/bin/env ruby
|
|
2
2
|
|
|
3
|
+
require "optparse"
|
|
3
4
|
require "phonemizer"
|
|
4
5
|
|
|
6
|
+
options = {
|
|
7
|
+
language: Phonemizer::DEFAULT_LANGUAGE,
|
|
8
|
+
phone_sep: "",
|
|
9
|
+
word_sep: " ",
|
|
10
|
+
strip_stress: true,
|
|
11
|
+
language_switch: :remove,
|
|
12
|
+
workers: Phonemizer::DEFAULT_WORKERS
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
parser = OptionParser.new do |o|
|
|
16
|
+
o.banner = "Usage: phonemize [options] [text | file]"
|
|
17
|
+
o.on("-l", "--language LANG",
|
|
18
|
+
"espeak voice (default: #{Phonemizer::DEFAULT_LANGUAGE})") { |v| options[:language] = v }
|
|
19
|
+
o.on("-p", "--phone-sep SEP",
|
|
20
|
+
"separator between phones (default: none)") { |v| options[:phone_sep] = v }
|
|
21
|
+
o.on("-w", "--word-sep SEP",
|
|
22
|
+
"separator between words in one utterance (default: space)") { |v| options[:word_sep] = v }
|
|
23
|
+
o.on("-s", "--[no-]strip-stress",
|
|
24
|
+
"strip stress marks and liaison hyphens (default: yes)") { |v| options[:strip_stress] = v }
|
|
25
|
+
o.on("-k", "--keep-language-switch",
|
|
26
|
+
"keep inline (en)/(fr) language tags (default: remove)") { options[:language_switch] = :keep }
|
|
27
|
+
o.on("-j", "--workers N", Integer,
|
|
28
|
+
"parallel espeak-ng calls (default: #{Phonemizer::DEFAULT_WORKERS})") { |v| options[:workers] = v }
|
|
29
|
+
o.on("-h", "--help", "show this help") do
|
|
30
|
+
puts o
|
|
31
|
+
exit
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
parser.parse!(ARGV)
|
|
35
|
+
|
|
5
36
|
text = ARGV.join(" ")
|
|
6
37
|
if File.file?(text)
|
|
7
38
|
lines = File.readlines(text, chomp: true).reject(&:empty?)
|
|
8
|
-
Phonemizer.phonemize(lines).each { |line| puts line }
|
|
39
|
+
Phonemizer.phonemize(lines, **options).each { |line| puts line }
|
|
9
40
|
else
|
|
10
|
-
puts Phonemizer.phonemize(text)
|
|
41
|
+
puts Phonemizer.phonemize(text, **options)
|
|
11
42
|
end
|
data/lib/phonemizer/version.rb
CHANGED