private void init(Object nameFinderModel, byte[] generatorDescriptor, Map<String, Object> resources, Map<String, String> manifestInfoEntries, SequenceCodec<String> seqCodec) { Properties manifest = (Properties) artifactMap.get(MANIFEST_ENTRY); manifest.put(SEQUENCE_CODEC_CLASS_NAME_PARAMETER, seqCodec.getClass().getName()); artifactMap.put(MAXENT_MODEL_ENTRY_NAME, nameFinderModel); if (generatorDescriptor != null && generatorDescriptor.length > 0) artifactMap.put(GENERATOR_DESCRIPTOR_ENTRY_NAME, generatorDescriptor); if (resources != null) { // The resource map must not contain key which are already taken // like the name finder maxent model name if (resources.containsKey(MAXENT_MODEL_ENTRY_NAME) || resources.containsKey(GENERATOR_DESCRIPTOR_ENTRY_NAME)) { throw new IllegalArgumentException(); } // TODO: Add checks to not put resources where no serializer exists, // make that case fail here, should be done in the BaseModel artifactMap.putAll(resources); } checkArtifactMap(); }
private void init(Object nameFinderModel, byte[] generatorDescriptor, Map<String, Object> resources, Map<String, String> manifestInfoEntries, SequenceCodec<String> seqCodec) { Properties manifest = (Properties) artifactMap.get(MANIFEST_ENTRY); manifest.put(SEQUENCE_CODEC_CLASS_NAME_PARAMETER, seqCodec.getClass().getName()); artifactMap.put(MAXENT_MODEL_ENTRY_NAME, nameFinderModel); if (generatorDescriptor != null && generatorDescriptor.length > 0) artifactMap.put(GENERATOR_DESCRIPTOR_ENTRY_NAME, generatorDescriptor); if (resources != null) { // The resource map must not contain key which are already taken // like the name finder maxent model name if (resources.containsKey(MAXENT_MODEL_ENTRY_NAME) || resources.containsKey(GENERATOR_DESCRIPTOR_ENTRY_NAME)) { throw new IllegalArgumentException(); } // TODO: Add checks to not put resources where no serializer exists, // make that case fail here, should be done in the BaseModel artifactMap.putAll(resources); } checkArtifactMap(); }
private void init(Object nameFinderModel, byte[] generatorDescriptor, Map<String, Object> resources, Map<String, String> manifestInfoEntries, SequenceCodec<String> seqCodec) { Properties manifest = (Properties) artifactMap.get(MANIFEST_ENTRY); manifest.put(SEQUENCE_CODEC_CLASS_NAME_PARAMETER, seqCodec.getClass().getName()); artifactMap.put(MAXENT_MODEL_ENTRY_NAME, nameFinderModel); if (generatorDescriptor != null && generatorDescriptor.length > 0) artifactMap.put(GENERATOR_DESCRIPTOR_ENTRY_NAME, generatorDescriptor); if (resources != null) { // The resource map must not contain key which are already taken // like the name finder maxent model name if (resources.containsKey(MAXENT_MODEL_ENTRY_NAME) || resources.containsKey(GENERATOR_DESCRIPTOR_ENTRY_NAME)) { throw new IllegalArgumentException(); } // TODO: Add checks to not put resources where no serializer exists, // make that case fail here, should be done in the BaseModel artifactMap.putAll(resources); } checkArtifactMap(); }