Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def try_import_unidic():
"""Import unidic or unidic-lite if available. Return dicdir.
This is specifically for dictionaries installed via pip.
"""
try:
import unidic
return unidic.DICDIR
except ImportError:
try:
import unidic_lite
return unidic_lite.DICDIR
except ImportError:
# This is OK, just give up.
return