def test_model_extracts_nickname_symbol_filter( model: DefinitionDetectionModel): prediction_type = "DocDef2" features = model.featurize("The agent acts with SYMBOL SYMBOL") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] == 0 assert slots[prediction_type][0] == ["O", "O", "O", "O", "O", "O"]
def test_model_extracts_simple_definitions(model: DefinitionDetectionModel): prediction_type = "W00" features = model.featurize("Neural networks are machine learning models.") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "TERM", "TERM", "O", "DEF", "DEF", "DEF", "O" ]
def test_model_extracts_nickname_symbol_separated_by_colon( model: DefinitionDetectionModel, ): prediction_type = "DocDef2" features = model.featurize("The agent acts with a policy : SYMBOL") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "O", "O", "DEF", "O", "TERM" ]
def test_model_extracts_nickname_symbol_parentheses( model: DefinitionDetectionModel): prediction_type = "DocDef2" features = model.featurize("The agent acts with policy (SYMBOL)") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "O", "DEF", "O", "TERM", "O" ]
def test_model_extract_abbreviation_shortened_word( model: DefinitionDetectionModel): prediction_type = "AI2020" features = model.featurize("We propose Conductive Networks (CondNets)") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "DEF", "DEF", "O", "TERM", "O" ]
def test_model_extracts_nickname_for_th_index_pattern( model: DefinitionDetectionModel): prediction_type = "DocDef2" features = model.featurize( "This process repeats for every SYMBOLth timestep") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "O", "O", "TERM", "DEF" ]
def test_model_extract_abbreviation_acronym(model: DefinitionDetectionModel): prediction_type = "AI2020" features = model.featurize( "We use a Convolutional Neural Network (CNN) based architecture") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "DEF", "DEF", "DEF", "O", "TERM", "O", "O", "O", ]
def test_model_extracts_nickname_before_symbol( model: DefinitionDetectionModel): prediction_type = "DocDef2" features = model.featurize( "The agent acts with a policy SYMBOL in each timestep SYMBOL") intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "O", "O", "DEF", "TERM", "O", "O", "DEF", "TERM", ]
def test_model_extracts_nickname_after_symbol(model: DefinitionDetectionModel): prediction_type = "DocDef2" features = model.featurize( "The architecture consists of SYMBOL dense layers trained with SYMBOL learning rate" ) intents, slots, _ = model.predict_batch([features], prediction_type) assert intents[prediction_type][0] assert slots[prediction_type][0] == [ "O", "O", "O", "O", "TERM", "DEF", "DEF", "O", "O", "TERM", "DEF", "DEF", ]
def model(): model = DefinitionDetectionModel(["AI2020", "DocDef2", "W00"]) return model
def model(): model = DefinitionDetectionModel() return model
def model(): model = DefinitionDetectionModel("DocDef2+AI2020+W00") return model