File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11"""Block udpipe.Base for tagging and parsing using UDPipe."""
22from udapi .core .block import Block
3- from udapi .tool .udpipe import UDPipe
43from udapi .tool .udpipeonline import UDPipeOnline
54from udapi .core .bundle import Bundle
65
6+ # Import UDPipe only if available (requires ufal.udpipe)
7+ try :
8+ from udapi .tool .udpipe import UDPipe
9+ UDPIPE_AVAILABLE = True
10+ except ImportError :
11+ UDPIPE_AVAILABLE = False
12+
713KNOWN_MODELS = {
814 'af' : 'models/udpipe/2.4/afrikaans-afribooms-ud-2.4-190531.udpipe' ,
915 'af_afribooms' : 'models/udpipe/2.4/afrikaans-afribooms-ud-2.4-190531.udpipe' ,
@@ -143,6 +149,8 @@ def tool(self):
143149 if self .online :
144150 self ._tool = UDPipeOnline (model = self .model )
145151 else :
152+ if not UDPIPE_AVAILABLE :
153+ raise ImportError ("UDPipe is not available. Install ufal.udpipe or use online=1" )
146154 self ._tool = UDPipe (model = self .model )
147155 return self ._tool
148156
You can’t perform that action at this time.
0 commit comments