class JcsegAnalyzer implements Analyzer {

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

    private static final SegmenterConfig CONFIG = new SegmenterConfig();
    private static final ADictionary DIC = DictionaryFactory.createDefaultDictionary(CONFIG);

    private final ISegment.Type type;

    public JcsegAnalyzer(String mode) {
        if (!SUPPORT_MODES.contains(mode)) {
            throw new ConfigException(
                    "Unsupported segment mode '%s' for jcseg analyzer, " +
                    "the available values are %s", mode, SUPPORT_MODES);
        }

        if ("Simple".equals(mode)) {
            this.type = ISegment.SIMPLE;
        } else {
            this.type = ISegment.COMPLEX;
        }
    }

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

        Set<String> result = InsertionOrderUtil.newSet();
        try {
            ISegment segmentor = this.type.factory.create(CONFIG, DIC);
            segmentor.reset(new StringReader(text));

            IWord word;
            while ((word = segmentor.next()) != null) {
                result.add(word.getValue());
            }
        } catch (Exception e) {
            throw new HugeException("Jcseg segment text '%s' failed", e, text);
        }
        return result;
    
<no_super_class>