deepset-ai / COVID-QA

API & Webapp to answer questions about COVID-19. Using NLP (Question Answering) and trusted data sources.
Apache License 2.0
344 stars 121 forks source link

PR_2_Structural_Design_Pattern(Bridge_Pattern) #159

Open SwithinTan opened 3 years ago

SwithinTan commented 3 years ago

LanguageDetector class in the file detect_language.py is split into three parts according to its methods, then we apply the Bridge design pattern to reorganize the function structure and main() method to instantiate the object and output our customized result. Benefits: Decouple the abstraction and implementation parts. The implementation is also changed dynamically at run time and the extensibility of abstraction and implementation is improved. If we want to change the detecting marks or change the output format we can modify those classes directly.