You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@joshua.apache.org by "Matt Post (JIRA)" <ji...@apache.org> on 2016/05/27 16:34:12 UTC

[jira] [Commented] (JOSHUA-275) Revamp the Configuration System

    [ https://issues.apache.org/jira/browse/JOSHUA-275?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15304288#comment-15304288 ] 

Matt Post commented on JOSHUA-275:
----------------------------------

This looks awesome to me. Can you give some indication / examples of how this can interplay with command-line switches? Will we be able to maintain the ability to (a) default to config-file parameters but (b) override from the command line?

I'm also curious if we'll lose the current flexibility in specifying names (e.g., all the following are the same: "-top-n", "-topN", "-topn"). That's a nice feature because you don't have to remember particulars, but I am fine if we have to say goodbye to it.

> Revamp the Configuration System
> -------------------------------
>
>                 Key: JOSHUA-275
>                 URL: https://issues.apache.org/jira/browse/JOSHUA-275
>             Project: Joshua
>          Issue Type: Improvement
>    Affects Versions: 6.1, 6.2, 7
>            Reporter: Kellen Sunderland
>
> I'd like to propose we centralize Joshua's configuration system to make use of typesafe/config https://github.com/typesafehub/config .  This config system looks like JSON but with comments so it's easy to read.  Because it's JSON it supports hierarchies of configurations, lists of configuration etc quite easily.  It has some nice features like parsing time automatically.  The main advantage here though is that we have a standard config system that doesn't have to be manually parsed.
> Here's a quick example of how we can use it:
> {code:java}
>     @Inject    
>     public PackedGrammar(@TypesafeConfig("PackedGrammar.grammar_dir")
>                          String grammar_dir,
>                          @TypesafeConfig("PackedGrammar.span_limit")
>                          int span_limit, 
>                          String owner, 
>                          String type) throws FileNotFoundException, IOException ...
> {code}
> and then a config similar to
> \# Joshua configuration file
> {code:javascript}
> config = {
>     default-non-terminal = X
>     goal-symbol = GOAL
>     ...
>     
>     PackedGrammar: {
>         type: thrax,
>         grammar_dir: /local/grammars/...
>         span_limit: 50
>     }
>     ...
> }
> {code}
> Version: TBD, but it's a breaking change so we may consider putting it in Joshua 7.
> Totally open to other config / injection systems if others want to suggest any of their favorites.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)