-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathipa_transcriber.rb
More file actions
executable file
·40 lines (32 loc) · 1.01 KB
/
ipa_transcriber.rb
File metadata and controls
executable file
·40 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/usr/bin/ruby -KuU
# encoding: utf-8
require 'optparse'
require_relative 'lib_transcribe.rb'
options = {}
OptionParser.new do |opts|
opts.banner = "Usage: ./ipa_transcriber.rb [options]"
opts.on("-f", "--filename FILE", "Source file") { |v| options[:filename] = v }
opts.on("-i", "--ipa-dict DICT", "IPA dictionary file") { |v| options[:dictfile] = v }
opts.on("-w", "--wordlist LIST", "Optional custom word list") { |v| options[:wordlist] = v }
end.parse!
if !options[:filename]
abort(" Please provide a source filename.")
end
if !options[:dictfile]
abort(" Please provide an IPA dictionary file.")
end
if options[:wordlist]
@wordlist = options[:wordlist]
if !File.exist?(@wordlist)
abort(" Specified wordlist file not found.")
end
end
source_file = options[:filename]
dict_file = options[:dictfile]
if !File.exist?(source_file)
abort(" Specified source file not found.")
end
if !File.exist?(dict_file)
abort(" Specified IPA dictionary not found.")
end
puts transcribe_ipa(source_file,dict_file)