Skip to content

Instantly share code, notes, and snippets.

@kzinmr
Last active August 22, 2019 19:45
Show Gist options
  • Save kzinmr/14c224efc43b7e21ff95fa9c54f829f1 to your computer and use it in GitHub Desktop.
Save kzinmr/14c224efc43b7e21ff95fa9c54f829f1 to your computer and use it in GitHub Desktop.
{
'NAME':
{
'Name_Other': {},
'Person': {},
'God': {},
'Organization':
{
'Organization_Other': {},
'International_Organization': {},
'Show_Organization': {},
'Family': {},
'Ethnic_Group':
{
'Ethnic_Group_Other': {},
'Nationality': {}
},
'Sports_Organization':
{
'Sports_Organization_Other': {},
'Pro_Sports_Organization': {},
'Sports_League': {}
},
'Corporation':
{
'Corporation_Other': {},
'Company': {},
'Company_Group': {}
},
'Political_Organization':
{
'Political_Organization_Other': {},
'Government': {},
'Political_Party': {},
'Cabinet': {},
'Military': {}
}
},
'Location':
{
'Location_Other': {},
'Spa': {},
'GPE':
{
'GPE_Other': {},
'City': {},
'County': {},
'Province': {},
'Country': {}
},
'Region':
{
'Region_Other': {},
'Continental_Region': {},
'Domestic_Region': {}
},
'Geological_Region':
{
'Geological_Region_Other': {},
'Mountain': {},
'Island': {},
'River': {},
'Lake': {},
'Sea': {},
'Bay': {}
},
'Astral_Body':
{
'Astral_Body_Other': {},
'Star': {},
'Planet': {},
'Constellation': {}
},
'Address':
{
'Address_Other': {},
'Postal_Address': {},
'Phone_Number': {},
'Email': {},
'URL': {}
},
},
'Facility':
{
'Facility_Other': {},
'Facility_Part': {},
'Archaeological_Place':
{
'Archaeological_Place_Other': {},
'Tumulus': {}
},
'GOE':
{
'GOE_Other': {},
'Public_Institution': {},
'School': {},
'Research_Institute': {},
'Market': {},
'Park': {},
'Sports_Facility': {},
'Museum': {},
'Zoo': {},
'Amusement_Park': {},
'Theater': {},
'Worship_Place': {},
'Car_Stop': {},
'Station': {},
'Airport': {},
'Port': {}
},
'Line':
{
'Line_Other': {},
'Railroad': {},
'Road': {},
'Canal': {},
'Water_Route': {},
'Tunnel': {},
'Bridge': {}
}
},
'Product':
{
'Product_Other': {},
'Material': {},
'Clothing': {},
'Money_Form': {},
'Drug': {},
'Weapon': {},
'Stock': {},
'Award': {},
'Decoration': {},
'Offence': {},
'Service': {},
'Class': {},
'Character': {},
'ID_Number': {},
'Vehicle':
{
'Vehicle_Other': {},
'Car': {},
'Train': {},
'Aircraft': {},
'Spaceship': {},
'Ship': {},
},
'Food':
{
'Food_Other': {},
'Dish': {}
},
'Art':
{
'Art_Other': {},
'Picture': {},
'Broadcast_Program': {},
'Movie': {},
'Show': {},
'Music': {},
'Book': {}
},
'Printing':
{
'Printing_Other': {},
'Newspaper': {},
'Magazine': {},
},
'Doctrine_Method':
{
'Doctrine_Method_Other': {},
'Culture': {},
'Religion': {},
'Academic': {},
'Sport': {},
'Style': {},
'Movement': {},
'Theory': {},
'Plan': {}
},
'Rule':
{
'Rule_Other': {},
'Treaty': {},
'Law': {}
},
'Title':
{
'Title_Other': {},
'Position_Vocation': {}
},
'Language':
{
'Language_Other': {},
'National_Language': {}
},
'Unit':
{
'Unit_Other': {},
'Currency': {}
}
},
'Event':
{
'Event_Other': {},
'Occasion':
{
'Occasion_Other': {},
'Religious_Festival': {},
'Game': {},
'Conference': {}
},
'Incident':
{
'Incident_Other': {},
'War': {}
},
'Natural_Phenomenon':
{
'Natural_Phenomenon_Other': {},
'Natural_Disaster': {},
'Earthquake': {}
}
},
'Natural_Object':
{
'Natural_Object_Other': {},
'Element': {},
'Compound': {},
'Mineral': {},
'Living_Thing':
{
'Living_Thing_Other': {},
'Fungus': {},
'Mollusc_Arthropod': {},
'Insect': {},
'Fish': {},
'Amphibia': {},
'Reptile': {},
'Bird': {},
'Mammal': {},
'Flora': {}
},
'Living_Thing_Part':
{
'Living_Thing_Part_Other': {},
'Animal_Part': {},
'Flora_Part': {}
}
},
'Disease':
{
'Disease_Other': {},
'Animal_Disease': {}
},
'Color':
{
'Color_Other': {},
'Nature_Color': {}
}
},
'Time_Top':
{
'Time_Top_Other': {},
'Timex':
{
'Timex_Other': {},
'Time': {},
'Date': {},
'Day_Of_Week': {},
'Era': {}
},
'Periodx':
{
'Periodx_Other': {},
'Period_Time': {},
'Period_Day': {},
'Period_Week': {},
'Period_Month': {},
'Period_Year': {}
}
},
'Numex':
{
'Numex_Other': {},
'Money': {},
'Stock_Index': {},
'Point': {},
'Percent': {},
'Multiplication': {},
'Frequency': {},
'Age': {},
'School_Age': {},
'Ordinal_Number': {},
'Rank': {},
'Latitude_Longtitude': {},
'Measurement':
{
'Measurement_Other': {},
'Physical_Extent': {},
'Space': {},
'Volume': {},
'Weight': {},
'Speed': {},
'Intensity': {},
'Temperature': {},
'Calorie': {},
'Seismic_Intensity': {},
'Seismic_Magnitude': {}
},
'Countx':
{
'Countx_Other': {},
'N_Person': {},
'N_Organization': {},
'N_Location':
{
'N_Location_Other': {},
'N_Country': {}
},
'N_Facility': {},
'N_Product': {},
'N_Event': {},
'N_Natural_Object':
{
'N_Natural_Object_Other': {},
'N_Animal': {},
'N_Flora': {}
}
}
}
}
@kzinmr
Copy link
Author

kzinmr commented Aug 22, 2019

def walk(d):
    for k, v in d.items():
        if not v:
            yield k
        else:
            for kk in walk(v):
                yield kk
with open('ene_labels_all.txt', 'w') as f:
    for k in list(walk(d)):
        f.write(f'B-{k}\n')
        f.write(f'I-{k}\n')

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment