{"record":{"id":"ead25221e0d878f0","repo":"stanfordnlp/CoreNLP","slug":"only-support-settings-for-ctb-and-pk-now-ead252","errorCode":null,"errorMessage":"only support settings for CTB and PK now.","messagePattern":"only support settings for CTB and PK now\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/wordseg/TagAffixDetector.java","lineNumber":35,"sourceCode":"  public TagAffixDetector(SeqClassifierFlags flags) {\n    String corporaDict;\n    if (flags.sighanCorporaDict != null) {\n      corporaDict = flags.sighanCorporaDict;\n    } else {\n      corporaDict = DEFAULT_CORPORA_DICT;\n    }\n\n    if ( ! corporaDict.isEmpty() && ! corporaDict.endsWith(\"/\")) {\n      corporaDict = corporaDict + '/';\n    }\n\n    String ccPath;\n    String adPath;\n    if (flags.useChPos || flags.useCTBChar2 || flags.usePKChar2) {\n      // if we're using POS information, override the ccPath\n      // For now we only have list for CTB and PK\n      if (flags.useASBCChar2 || flags.useHKChar2 || flags.useMSRChar2) {\n        throw new RuntimeException(\"only support settings for CTB and PK now.\");\n      } else if (flags.useCTBChar2) {\n        ccPath = corporaDict+\"dict/character_list\";\n        adPath = corporaDict+\"dict/in.ctb\";\n      } else if (flags.usePKChar2) {\n        ccPath = corporaDict+\"dict/pos_open/character_list.pku.utf8\";\n        adPath = corporaDict+\"dict/in.pk\";\n      } else {\n        throw new RuntimeException(\"none of flags.useXXXChar2 are on\");\n      }\n    } else {\n      ccPath = corporaDict+\"dict/pos_close/char.ctb.list\";\n      adPath = corporaDict+\"dict/in.ctb\";\n    }\n    if (VERBOSE) {\n      logger.info(\"TagAffixDetector: useChPos=\" + flags.useChPos +\n              \" | useCTBChar2=\" + flags.useCTBChar2 + \" | usePKChar2=\" + flags.usePKChar2);\n      logger.info(\"TagAffixDetector: building TagAffixDetector from \" + ccPath + \" and \" + adPath);\n    }","sourceCodeStart":17,"sourceCodeEnd":53,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/wordseg/TagAffixDetector.java#L17-L53","documentation":"TagAffixDetector picks character-list and affix dictionary paths for char-based POS features. When useChPos/useCTBChar2/usePKChar2 is on but one of the unsupported ASBC/HK/MSR char2 flags is also set, it throws RuntimeException because path lists exist only for CTB and PK.","triggerScenarios":"Constructing TagAffixDetector with (useChPos || useCTBChar2 || usePKChar2) AND (useASBCChar2 || useHKChar2 || useMSRChar2) true.","commonSituations":"Enabling multiple corpus flags together by mistake (e.g. copying a properties file for MSR data while leaving CTB/PK flags on); trying to use tag-affix detection with ASBC/HK/MSR corpora.","solutions":["Turn off useASBCChar2/useHKChar2/useMSRChar2 and keep only useCTBChar2 or usePKChar2","If you need ASBC/HK/MSR support, supply your own character-list and in.* dictionary paths (requires code change)","Review the properties file so exactly one corpus char2 flag is enabled"],"exampleFix":"// before (Properties)\nuseCTBChar2=true\nuseMSRChar2=true\n// after (Properties)\nuseCTBChar2=true\nuseMSRChar2=false","handlingStrategy":"validation","validationCode":"Properties p = /* props */;\nboolean char2on = Boolean.parseBoolean(p.getProperty(\"useChPos\",\"false\"))\n  || Boolean.parseBoolean(p.getProperty(\"useCTBChar2\",\"false\"))\n  || Boolean.parseBoolean(p.getProperty(\"usePKChar2\",\"false\"));\nboolean unsupported = Boolean.parseBoolean(p.getProperty(\"useASBCChar2\",\"false\"))\n  || Boolean.parseBoolean(p.getProperty(\"useHKChar2\",\"false\"))\n  || Boolean.parseBoolean(p.getProperty(\"useMSRChar2\",\"false\"));\nif (char2on && unsupported) {\n  throw new IllegalArgumentException(\"TagAffixDetector supports only CTB/PK char2 settings\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  new TagAffixDetector(flags);\n} catch (RuntimeException e) {\n  if (e.getMessage().contains(\"CTB and PK\")) {\n    flags.useMSRChar2 = false;\n    new TagAffixDetector(flags);\n  } else throw e;\n}","preventionTips":["Enable exactly one corpus char2 flag (CTB or PK) per configuration","Never combine ASBC/HK/MSR char2 flags with useChPos","Validate props files with a small preflight script before launching training"],"tags":["java","chinese-segmentation","configuration","conflicting-flags"],"backgroundTag":"conflicting-config-options","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}