private FeatureExtractor readExtractorRule(String ns, String line, int nGram)
    {
        int relPos;
        int componentIndex;


        List<FeatureExtractorPart> parts = new ArrayList<FeatureExtractorPart>();
        StringBuffer sb = new StringBuffer();

        while (!line.isEmpty())
        {

            if (line.startsWith("%x["))
            {
                String sbStr = sb.toString();
                if (!sbStr.isEmpty())
                {
                    parts.add(new LiteralPart(sbStr));
                    sb = new StringBuffer();
                }
                String dims = line.substring(line.indexOf("[") + 1, line.indexOf("]"));

                String[] relPosIndex = dims.split(",");
                relPos = Integer.valueOf(relPosIndex[0]);
                componentIndex = relPosIndex.length == 2 ? Integer.valueOf(relPosIndex[1]) : 0;
                parts.add(new ExtractPart(nGram, relPos, componentIndex));
                int start = line.indexOf("]") + 1;
                if (start == line.length())
                {
                    line = "";
                }
                else
                {
                    line = line.substring(start);
                }
            }
            else
            {
                int nextVar = line.indexOf("%x");
                if (nextVar < 1)
                {
                    nextVar = line.length();
                }
                sb.append(line.substring(0, nextVar));
                line = line.substring(nextVar);
            }

        }
        String sbStr = sb.toString();
        if (!sbStr.isEmpty())
        {
            parts.add(new LiteralPart(sbStr));
        }


        return new FeatureExtractor(ns, parts);
    }