class MMSeg4JAnalyzer implements Analyzer {

    public static final List<String> SUPPORT_MODES = ImmutableList.of(
            "Simple",
            "Complex",
            "MaxWord"
    );

    private static final Dictionary DIC = Dictionary.getInstance();

    private final Seg seg;

    public MMSeg4JAnalyzer(String mode) {
        if (!SUPPORT_MODES.contains(mode)) {
            throw new ConfigException(
                    "Unsupported segment mode '%s' for mmseg4j analyzer, " +
                    "the available values are %s", mode, SUPPORT_MODES);
        }
        int index = SUPPORT_MODES.indexOf(mode);
        switch (index) {
            case 0:
                this.seg = new SimpleSeg(DIC);
                break;
            case 1:
                this.seg = new ComplexSeg(DIC);
                break;
            case 2:
                this.seg = new MaxWordSeg(DIC);
                break;
            default:
                throw new AssertionError(String.format(
                        "Unsupported segment mode '%s'", mode));
        }
    }

    @Override
    public Set<String> segment(String text) {<FILL_FUNCTION_BODY>}
}

        Set<String> result = InsertionOrderUtil.newSet();
        MMSeg mmSeg = new MMSeg(new StringReader(text), this.seg);
        try {
            Word word;
            while ((word = mmSeg.next()) != null) {
                result.add(word.getString());
            }
        } catch (Exception e) {
            throw new HugeException("MMSeg4j segment text '%s' failed",
                                    e, text);
        }
        return result;
    
<no_super_class>