initial test run
This commit is contained in:
commit
c41d30a6e2
|
@ -0,0 +1,9 @@
|
||||||
|
/.bundle/
|
||||||
|
/.yardoc
|
||||||
|
/Gemfile.lock
|
||||||
|
/_yardoc/
|
||||||
|
/coverage/
|
||||||
|
/doc/
|
||||||
|
/pkg/
|
||||||
|
/spec/reports/
|
||||||
|
/tmp/
|
|
@ -0,0 +1,3 @@
|
||||||
|
language: ruby
|
||||||
|
rvm:
|
||||||
|
- 2.1.2
|
|
@ -0,0 +1,13 @@
|
||||||
|
# Contributor Code of Conduct
|
||||||
|
|
||||||
|
As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
|
||||||
|
|
||||||
|
We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, age, or religion.
|
||||||
|
|
||||||
|
Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
|
||||||
|
|
||||||
|
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
|
||||||
|
|
||||||
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
|
||||||
|
|
||||||
|
This Code of Conduct is adapted from the [Contributor Covenant](http:contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
|
|
@ -0,0 +1,4 @@
|
||||||
|
source 'https://rubygems.org'
|
||||||
|
|
||||||
|
# Specify your gem's dependencies in string_to_ipa.gemspec
|
||||||
|
gemspec
|
|
@ -0,0 +1,21 @@
|
||||||
|
The MIT License (MIT)
|
||||||
|
|
||||||
|
Copyright (c) 2015 Hilary Stohs-Krause
|
||||||
|
|
||||||
|
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.
|
|
@ -0,0 +1,50 @@
|
||||||
|
# StringToIpa
|
||||||
|
|
||||||
|
A simple little Ruby gem that converts strings to the International Phonetic Alphabet.
|
||||||
|
|
||||||
|
## Installation
|
||||||
|
|
||||||
|
Add this line to your application's Gemfile:
|
||||||
|
|
||||||
|
```ruby
|
||||||
|
gem 'string_to_ipa'
|
||||||
|
```
|
||||||
|
|
||||||
|
And then execute:
|
||||||
|
|
||||||
|
$ bundle
|
||||||
|
|
||||||
|
Or install it yourself as:
|
||||||
|
|
||||||
|
$ gem install string_to_ipa
|
||||||
|
|
||||||
|
## Usage
|
||||||
|
|
||||||
|
To convert a string to the International Phonetic Alphabet:
|
||||||
|
|
||||||
|
```"yay".to_ipa
|
||||||
|
=> "jˈeɪ" ```
|
||||||
|
|
||||||
|
## Contributing
|
||||||
|
|
||||||
|
1. Fork it ( https://github.com/hilarysk/string_to_ipa/fork )
|
||||||
|
2. Create your feature branch (`git checkout -b my-new-feature`)
|
||||||
|
3. Commit your changes (`git commit -am 'Add some feature'`)
|
||||||
|
4. Push to the branch (`git push origin my-new-feature`)
|
||||||
|
5. Create a new Pull Request
|
||||||
|
|
||||||
|
## Copyright notice
|
||||||
|
|
||||||
|
The [Carnegie Mellon University Pronouncing Dictionary](http://www.speech.cs.cmu.edu/cgi-bin/cmudict) was used in the creation of this gem. Their copyright notice follows:
|
||||||
|
|
||||||
|
*Copyright (C) 1993-2015 Carnegie Mellon University. All rights reserved.*
|
||||||
|
|
||||||
|
*Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:*
|
||||||
|
|
||||||
|
*1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. The contents of this file are deemed to be source code*
|
||||||
|
|
||||||
|
*2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.*
|
||||||
|
|
||||||
|
*This work was supported in part by funding from the Defense Advanced Research Projects Agency, the Office of Naval Research and the National Science Foundation of the United States of America, and by member companies of the Carnegie Mellon Sphinx Speech Consortium. We acknowledge the contributions of many volunteers to the expansion and improvement of this dictionary.*
|
||||||
|
|
||||||
|
*THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY 'AS IS' AND ANY EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL CARNEGIE MELLON UNIVERSITY NOR ITS EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.*
|
|
@ -0,0 +1,14 @@
|
||||||
|
#!/usr/bin/env ruby
|
||||||
|
|
||||||
|
require "bundler/setup"
|
||||||
|
require "string_to_ipa"
|
||||||
|
|
||||||
|
# You can add fixtures and/or initialization code here to make experimenting
|
||||||
|
# with your gem easier. You can also use a different console, if you like.
|
||||||
|
|
||||||
|
# (If you use this, don't forget to add pry to your Gemfile!)
|
||||||
|
# require "pry"
|
||||||
|
# Pry.start
|
||||||
|
|
||||||
|
require "irb"
|
||||||
|
IRB.start
|
|
@ -0,0 +1,7 @@
|
||||||
|
#!/bin/bash
|
||||||
|
set -euo pipefail
|
||||||
|
IFS=$'\n\t'
|
||||||
|
|
||||||
|
bundle install
|
||||||
|
|
||||||
|
# Do any other automated setup that you need to do here
|
|
@ -0,0 +1,64 @@
|
||||||
|
require "string_to_ipa/version"
|
||||||
|
require "sqlite3"
|
||||||
|
|
||||||
|
module StringToIpa
|
||||||
|
DATABASE = SQLite3::Database.new("ipagem.db")
|
||||||
|
|
||||||
|
DATABASE.results_as_hash = true
|
||||||
|
DATABASE.execute( "PRAGMA encoding = \"UTF-16\"" );
|
||||||
|
|
||||||
|
class Phonetic
|
||||||
|
attr_accessor :word, :phonetic
|
||||||
|
attr_reader :id
|
||||||
|
|
||||||
|
def initialize(options)
|
||||||
|
@word = options["word"]
|
||||||
|
@phonetic = options["phonetic"]
|
||||||
|
@id = options["id"]
|
||||||
|
end
|
||||||
|
|
||||||
|
def insert
|
||||||
|
DATABASE.execute("INSERT INTO phonetics (word, phonetic) VALUES (?, ?)", @word, @phonetic)
|
||||||
|
@id = DATABASE.last_insert_row_id
|
||||||
|
end
|
||||||
|
|
||||||
|
def save
|
||||||
|
attributes = []
|
||||||
|
|
||||||
|
instance_variables.each do |i|
|
||||||
|
attributes << i.to_s.delete("@")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
query_hash = {}
|
||||||
|
|
||||||
|
attributes.each do |a|
|
||||||
|
value = self.send(a)
|
||||||
|
query_hash[a] = value
|
||||||
|
end
|
||||||
|
|
||||||
|
query_hash.each do |key, value|
|
||||||
|
DATABASE.execute("UPDATE phonetics SET #{key} = ? WHERE id = #{@id}", value)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
def delete
|
||||||
|
DATABASE.execute("DELETE FROM phonetics WHERE id = #{@id}")
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
def self.find(s_id)
|
||||||
|
result = DATABASE.execute("SELECT * FROM phonetics WHERE id = #{s_id}")[0]
|
||||||
|
|
||||||
|
self.new(result)
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
end
|
||||||
|
|
||||||
|
class String
|
||||||
|
def to_ipa
|
||||||
|
StringToIpa::DATABASE.execute("SELECT phonetic from phonetics where word = ?", self.upcase)[0]["phonetic"]
|
||||||
|
end
|
||||||
|
end
|
|
@ -0,0 +1,3 @@
|
||||||
|
module StringToIpa
|
||||||
|
VERSION = "0.1.5"
|
||||||
|
end
|
|
@ -0,0 +1,31 @@
|
||||||
|
# coding: utf-8
|
||||||
|
lib = File.expand_path('../lib', __FILE__)
|
||||||
|
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
||||||
|
require 'string_to_ipa/version'
|
||||||
|
|
||||||
|
Gem::Specification.new do |spec|
|
||||||
|
spec.name = "string_to_ipa"
|
||||||
|
spec.version = StringToIpa::VERSION
|
||||||
|
spec.authors = ["Hilary Stohs-Krause"]
|
||||||
|
spec.email = ["hilarysk@gmail.com"]
|
||||||
|
|
||||||
|
spec.summary = %q{Write a short summary, because Rubygems requires one.} #fill these out
|
||||||
|
spec.description = %q{ Write a longer description or delete this line.}
|
||||||
|
spec.homepage = "http://example.com"
|
||||||
|
spec.license = "MIT"
|
||||||
|
|
||||||
|
spec.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
||||||
|
spec.bindir = "exe"
|
||||||
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
||||||
|
spec.require_paths = ["lib"]
|
||||||
|
|
||||||
|
if spec.respond_to?(:metadata)
|
||||||
|
spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
|
||||||
|
end
|
||||||
|
|
||||||
|
spec.add_dependency "sqlite3"
|
||||||
|
|
||||||
|
spec.add_development_dependency "bundler", "~> 1.9"
|
||||||
|
spec.add_development_dependency "rake", "~> 10.0"
|
||||||
|
|
||||||
|
end
|
|
@ -0,0 +1,4 @@
|
||||||
|
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
|
||||||
|
require 'string_to_ipa'
|
||||||
|
|
||||||
|
require 'minitest/autorun'
|
|
@ -0,0 +1,11 @@
|
||||||
|
require 'minitest_helper'
|
||||||
|
|
||||||
|
class TestStringToIpa < Minitest::Test
|
||||||
|
def test_that_it_has_a_version_number
|
||||||
|
refute_nil ::StringToIpa::VERSION
|
||||||
|
end
|
||||||
|
|
||||||
|
def test_it_does_something_useful
|
||||||
|
assert false
|
||||||
|
end
|
||||||
|
end
|
Loading…
Reference in New Issue