Entity extractor function