Skip to content

Instantly share code, notes, and snippets.

@AlJohri
Created April 22, 2016 17:21
Show Gist options
  • Save AlJohri/315251f54653a3c3ffe3ccb41b074848 to your computer and use it in GitHub Desktop.
Save AlJohri/315251f54653a3c3ffe3ccb41b074848 to your computer and use it in GitHub Desktop.
class Openfst < Formula
homepage "http://www.openfst.org/"
url "http://openfst.cs.nyu.edu/twiki/pub/FST/FstDownload/openfst-1.4.1.tar.gz"
sha256 "e671bf6bd4425a1fed4e7543a024201b74869bfdd029bdf9d10c53a3c2818277"
needs :cxx11
def install
ENV.cxx11
system "./configure", "--prefix=#{prefix}",
"--enable-static",
"--enable-shared",
"--enable-far",
"--enable-lookahead-fsts",
"--enable-const-fsts",
"--enable-pdt",
"--enable-ngram-fsts",
"--enable-linear-fsts"
system "make", "install"
end
test do
# Based on http://openfst.org/twiki/bin/view/FST/FstExamples.
# Makes symbol table.
File.open("ascii.syms", "w") do |sink|
sink.puts "<epsilon>\t0"
sink.puts "<space>\t32"
33.upto(126) { |i| sink.puts "#{i.chr}\t#{i}" }
end
# Makes arclist for downcasing FST.
File.open("downcase.arc", "w") do |sink|
sink.puts "0\t0\t<epsilon>\t<epsilon>"
sink.puts "0\t0\t<space>\t<space>"
33.upto(126) { |i| sink.puts "0\t0\t#{i.chr}\t#{i.chr.downcase}" }
sink.puts "0"
end
## Compile the machine
system bin/"fstcompile", "--isymbols=ascii.syms",
"--osymbols=ascii.syms",
"downcase.arc",
"downcase.fst"
end
end
@AlJohri
Copy link
Author

AlJohri commented Apr 22, 2016

What was changed from the most recent version?

  1. Downgrade to 1.4.1 (and change corresponding sha256).
  2. Remove bottles to force install by default. (Can also use --build-from-source)
  3. Use install options specific to Phonetisaurus.
"--enable-static",
"--enable-shared",
"--enable-far",
"--enable-lookahead-fsts",
"--enable-const-fsts",
"--enable-pdt",
"--enable-ngram-fsts",
"--enable-linear-fsts"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment