Such data belongs into Priv, and even then I think it should be compiled into the module directly by reading the file into a module attribute during compile time.
This won’t work if the cwd changes or it’s an embedded tar or so, you should always get the priv directory by asking for the priv directories location like: File.string!(to_string(:code.priv_dir(:cmu))<>"/cmudict-0.7b.txt")
Or whatever the application name is should go inside the :code.priv_dir/1 call
Also, it returns an iolist (charlist specifically), so need to run to_string(...) on it as I updated my post if you want to update yours too, my bad. ^.^;
It would not work in prod environment after deployment, because you have no source code tree there. :code.priv_dir/1 is used to solve problem with such extra files.
If I remember correctly {:error, :bad_name} happens when your app (here :cmu) is not found. Not sure, but you need to add some extra configuration to mix.exs in project which uses your library. However I don’t had such error for a long time, so I simply do not remember it.