MCPcopy Create free account
hub / github.com/ICTMCG/FakeSV / str2num

Function str2num

code/utils/dataloader.py:19–30  ·  view source on GitHub ↗
(str_x)

Source from the content-addressed store, hash-verified

17from transformers import BertTokenizer
18
19def str2num(str_x):
20 if isinstance(str_x, float):
21 return str_x
22 elif str_x.isdigit():
23 return int(str_x)
24 elif 'w' in str_x:
25 return float(str_x[:-1])*10000
26 elif '亿' in str_x:
27 return float(str_x[:-1])*100000000
28 else:
29 print ("error")
30 print (str_x)
31
32
33class SVFENDDataset(Dataset):

Callers 4

__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85
__getitem__Method · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected