Current section
8 Versions
Jump to
Current section
8 Versions
Compare versions
8
files changed
+162
additions
-143
deletions
| @@ -5,8 +5,9 @@ | |
| 5 5 | {<<"elixir">>,<<"~> 1.10">>}. |
| 6 6 | {<<"files">>, |
| 7 7 | [<<"lib">>,<<"lib/talk_like_a_x">>,<<"lib/talk_like_a_x/translator.ex">>, |
| 8 | + <<"lib/talk_like_a_x/lingos">>,<<"lib/talk_like_a_x/lingos/pirate.ex">>, |
| 9 | + <<"lib/talk_like_a_x/lingos/surfer.ex">>, |
| 8 10 | <<"lib/talk_like_a_x/lingo_loader.ex">>,<<"lib/talk_like_a_x.ex">>, |
| 9 | - <<"lib/lingos">>,<<"lib/lingos/surfer.yml">>,<<"lib/lingos/pirate.yml">>, |
| 10 11 | <<".formatter.exs">>,<<"mix.exs">>,<<"README.md">>]}. |
| 11 12 | {<<"licenses">>,[<<"MIT">>]}. |
| 12 13 | {<<"links">>, |
| @@ -23,4 +24,4 @@ | |
| 23 24 | {<<"optional">>,false}, |
| 24 25 | {<<"repository">>,<<"hexpm">>}, |
| 25 26 | {<<"requirement">>,<<"~> 1.0">>}]]}. |
| 26 | - {<<"version">>,<<"0.0.5">>}. |
| 27 | + {<<"version">>,<<"0.0.6">>}. |
| @@ -1,132 +0,0 @@ | |
| 1 | - gerund: |
| 2 | - ing: in' |
| 3 | - ings: in's |
| 4 | - words: |
| 5 | - "i'm": i be |
| 6 | - "isn't": be not |
| 7 | - "it's": "'tis" |
| 8 | - "that's": that be |
| 9 | - "we're": "we's" |
| 10 | - "you're": you be |
| 11 | - "you've": ye |
| 12 | - address: port o' call |
| 13 | - admin: helm |
| 14 | - afraid: afeared |
| 15 | - am: be |
| 16 | - an: a |
| 17 | - and: "n'" |
| 18 | - are: be |
| 19 | - award: prize |
| 20 | - beer: grog |
| 21 | - before: afore |
| 22 | - belief: creed |
| 23 | - between: betwixt |
| 24 | - big: vast |
| 25 | - boss: admiral |
| 26 | - bourbon: rum |
| 27 | - box: barrel |
| 28 | - boy: lad |
| 29 | - bring: bring |
| 30 | - business: company |
| 31 | - businesses: companies |
| 32 | - calling: "callin'" |
| 33 | - canada: "Great North" |
| 34 | - cash: doubloons |
| 35 | - captain: "cap'n" |
| 36 | - cheat: hornswaggle |
| 37 | - comments: yer words |
| 38 | - country: land |
| 39 | - dashboard: shanty |
| 40 | - disconnect: keelhaul |
| 41 | - do: "d'" |
| 42 | - dollar: doubloon |
| 43 | - dude: pirate |
| 44 | - employee: crew |
| 45 | - everyone: all hands |
| 46 | - eye: eye-patch |
| 47 | - family: kin |
| 48 | - fee: debt |
| 49 | - female: wench |
| 50 | - for: fer |
| 51 | - food: grub |
| 52 | - friend: matey |
| 53 | - friends: "me hearties" |
| 54 | - gin: rum |
| 55 | - girl: lass |
| 56 | - girls: lassies |
| 57 | - go: sail |
| 58 | - good: jolly good |
| 59 | - group: maties |
| 60 | - halt: heave |
| 61 | - hand: hook |
| 62 | - hello: ahoy |
| 63 | - hey: ahoy |
| 64 | - hotel: inn |
| 65 | - internet: series o' tubes |
| 66 | - invalid: sunk |
| 67 | - is: be |
| 68 | - island: isle |
| 69 | - jail: brig |
| 70 | - kill: keelhaul |
| 71 | - king: king |
| 72 | - lady: lass |
| 73 | - leg: peg |
| 74 | - logout: walk the plank |
| 75 | - male: pirate |
| 76 | - man: pirate |
| 77 | - map: chart |
| 78 | - manager: admiral |
| 79 | - money: doubloons |
| 80 | - month: moon |
| 81 | - my: me |
| 82 | - never: nary |
| 83 | - no: nay |
| 84 | - of: "o'" |
| 85 | - over: "o'er" |
| 86 | - page: parchment |
| 87 | - person: scallywag |
| 88 | - posted: tacked to the yardarm |
| 89 | - president: king |
| 90 | - prison: brig |
| 91 | - quickly: smartly |
| 92 | - really: verily |
| 93 | - relatives: kin |
| 94 | - religion: creed |
| 95 | - ring: ring |
| 96 | - rob: pillage |
| 97 | - robbery: piracy |
| 98 | - role: job |
| 99 | - say: cry |
| 100 | - sailor: "jack tar" |
| 101 | - seconds: ticks o' tha clock |
| 102 | - shipping: cargo |
| 103 | - small: puny |
| 104 | - soldier: sailor |
| 105 | - sorry: yarr |
| 106 | - spouse: ball 'n' chain |
| 107 | - state: land |
| 108 | - steal: plunder |
| 109 | - stranded: marooned |
| 110 | - supervisor: "Cap'n" |
| 111 | - sword: cutlass |
| 112 | - telescope: spyglass |
| 113 | - the: tha |
| 114 | - them: "'em" |
| 115 | - thing: thing |
| 116 | - this: dis |
| 117 | - to: t' |
| 118 | - vodka: rum |
| 119 | - we: our jolly crew |
| 120 | - whiskey: rum |
| 121 | - whisky: rum |
| 122 | - whip: flog |
| 123 | - wine: grog |
| 124 | - with: wit' |
| 125 | - woman: wench |
| 126 | - work: duty |
| 127 | - wow: blimey |
| 128 | - yah: aye |
| 129 | - yeah: aye |
| 130 | - yes: aye |
| 131 | - you: ye |
| 132 | - your: yer |
| @@ -1,4 +0,0 @@ | |
| 1 | - words: |
| 2 | - hello: sup |
| 3 | - hi: sup |
| 4 | - bro: bruh |
| @@ -39,12 +39,12 @@ defmodule TalkLikeAX do | |
| 39 39 | |
| 40 40 | |
| 41 41 | iex> TalkLikeAX.translate("Hello friend, doctorargus", :doesnt_exist) |
| 42 | - { :error, :file_not_found } |
| 42 | + { :error, :lingo_doesnt_exist } |
| 43 43 | """ |
| 44 44 | def translate(words, lingo \\ :pirate) when is_bitstring(words) do |
| 45 45 | case LingoLoader.load_lingo(lingo) do |
| 46 46 | {:ok, lingo_map} -> {:ok, Translator.translate_to_lingo(words, lingo_map)} |
| 47 | - {:error, _} -> {:error, :file_not_found} |
| 47 | + {:error, msg} -> {:error, msg} |
| 48 48 | end |
| 49 49 | end |
| @@ -2,8 +2,11 @@ defmodule TalkLikeAX.LingoLoader do | |
| 2 2 | @moduledoc false |
| 3 3 | |
| 4 4 | def load_lingo(lingo \\ :pirate) do |
| 5 | - path = Path.expand("lingos/#{lingo}.yml", "lib") |> Path.absname |
| 6 | - YamlElixir.read_from_file(path) |
| 5 | + case lingo do |
| 6 | + :pirate -> {:ok, TalkLikeAX.Lingos.Pirate.map() } |
| 7 | + :surfer -> {:ok, TalkLikeAX.Lingos.Surfer.map() } |
| 8 | + _ -> {:error, :lingo_doesnt_exist} |
| 9 | + end |
| 7 10 | end |
| 8 11 | |
| 9 12 | def load_lingo_and_extend(extended_lingo) when is_map(extended_lingo) do |
Loading more files…