Performance Comparison of Rule Matching, spaCy and BERT for Location Extraction in Unstructured Texts
Abstract
Extracting location information from tweets and other social software statements is essential for governments and organisations to make timely decisions. However, challenges include extracting valid locations from massive posts and handling latest events in a few posts, which require models to process data quickly and extract the correct locations from small data. This paper constructs a comparative experimental framework for location entity recognition based on three techniques, namely rule matching, spaCy, and BERT. This study selects about 19,000 labelled social media posts. Results show that rule matching has a high precision rate (>90%), but suffers a low recall rate (~35%) and low efficiency; the spaCy (en_core_web_sm) model balances performance under full data training (F1: 0.8778, recall: 100%), and its small sample version (only 100 data) still maintains excellent performance (F1: 0.9040), demonstrating a strong small sample adaptability; the BERT model performs outstandingly in the semantic understanding task (F1: 0.8418), but its small-sample version suffers from a significant overfitting problem.
References
- Xu, Z., Zhang, H., Sugumaran, V., Choo, K. K. R., Mei, L., & Zhu, Y. (2016). Participatory sensing-based semantic and spatial analysis of urban emergency events using mobile social media. EURASIP Journal on Wireless Communications and Networking, 2016, 1-9.
- Berragan, C., Singleton, A., Calafiore, A., & Morley, J. (2023). Transformer based named entity recognition for place name extraction from unstructured text. International Journal of Geographical Information Science, 37(4), 747-766.
- Jehangir, B., Radhakrishnan, S., & Agarwal, R. (2023). A survey on named entity recognition—datasets, tools, and methodologies. Natural Language Processing Journal, 3, 100017.
- Sergeant 416. (2019) NLP Learning: task2: Feature Extraction: Basic Text Processing, Language Models. https: //blog.csdn.net/weixin_39441762/article/details/88139574.
- Jiang, Q., Gui, Q., Wang, L., Xu, R., Wang, J., Mai, L., & spaCyXu, S. (2022). A Survey of Named Entity Recognition. Power of information and communication technology, 20 (02), 15-24.
- Schmitt, X., Kubler, S., Robert, J., Papadakis, M., & LeTraon, Y. (2019). A replicable comparison study of NER software: StanfordNLP, NLTK, OpenNLP, , Gate. In 2019 sixth international conference on social networks analysis, management and security (SNAMS) Granada. pp. 338–343.
- Siva Rama Rao, A. V., Vamsi, P. V. V., Rashmika, N., Hemanth, K., & Aditya Kumar, K. (2022). Named Entity Recognition Using Stanford Classes and NLTK. In Proceedings of Second International Conference on Sustainable Expert Systems: ICSES 2021. Singapore. pp. 583–597.
- Dharma, E. M., Gaol, F. L., Warnars, H. L. H. S., & Soewito, B. E. N. F. A. N. O. (2022). The accuracy comparison among word2vec, glove, and fasttext towards convolution neural network (cnn) text classification. Journal of Theoretical and Applied Information Technology, 100(2): 31.
- Tang, B., Cao, H., Wu, Y., Jiang, M., & Xu, H. (2013). Recognizing clinical entities in hospital discharge summaries using Structural Support Vector Machines with word representation features. In BMC medical informatics and decision making, 13: 1–10.
- Devlin, J., Chang, M. W., Lee, K., & Toutanova, K. (2019). Bert: Pre-training of deep bidirectional transformers for language understanding. In Proceedings of the 2019 conference of the North American chapter of the association for computational linguistics: human language technologies, volume 1 (long and short papers). Minneapolis. pp. 4171–4186.
- Embrace Ai. (2025). Advanced NLP: BERT + CRF for Named Entity Recognition (NER) CSDN Blog. https: //blog.csdn.net/qq_42014575/article/details/145136315.
- Souza, F., Nogueira, R., & Lotufo, R. (2019). Portuguese named entity recognition using BERT-CRF. arXiv preprint arXiv: 1909.10649.
- Liu, H., Qiu, Q., Wu, L., Li, W., Wang, B., & Zhou, Y. (2022). Few-shot learning for name entity recognition in geological text based on GeoBERT. Earth Science Informatics, 15(2), 979-991.
- Haklay, M., & Weber, P. (2008). Openstreetmap: User-generated street maps. IEEE Pervasive computing, 7(4), 12-18.
- Eduardo Toledo. (2024) ai4good_location_mention_recognition. https: //github.com/etechoptimist/ai4good_location_mention_recognition.git.
- Syed, M. A., Arsevska, E., Roche, M., & Teisseire, M. (2025). GeospatRE: extraction and geocoding of spatial relation entities in textual documents. Cartography and Geographic Information Science, 52(3), 221-236.