Views
No views yet
| Name | Quant method | Size |
|---|---|---|
| gemma2-2b-ner.Q2_K.gguf | Q2_K | 1.15GB |
| gemma2-2b-ner.IQ3_XS.gguf | IQ3_XS | 1.22GB |
| gemma2-2b-ner.IQ3_S.gguf | IQ3_S | 1.27GB |
| gemma2-2b-ner.Q3_K_S.gguf | Q3_K_S | 1.27GB |
| gemma2-2b-ner.IQ3_M.gguf | IQ3_M | 1.3GB |
| gemma2-2b-ner.Q3_K.gguf | Q3_K | 1.36GB |
| gemma2-2b-ner.Q3_K_M.gguf | Q3_K_M | 1.36GB |
| gemma2-2b-ner.Q3_K_L.gguf | Q3_K_L | 1.44GB |
| gemma2-2b-ner.IQ4_XS.gguf | IQ4_XS | 1.47GB |
| gemma2-2b-ner.Q4_0.gguf | Q4_0 | 1.52GB |
| gemma2-2b-ner.IQ4_NL.gguf | IQ4_NL | 1.53GB |
| gemma2-2b-ner.Q4_K_S.gguf | Q4_K_S | 1.53GB |
| gemma2-2b-ner.Q4_K.gguf | Q4_K | 1.59GB |
| gemma2-2b-ner.Q4_K_M.gguf | Q4_K_M | 1.59GB |
| gemma2-2b-ner.Q4_1.gguf | Q4_1 | 1.64GB |
| gemma2-2b-ner.Q5_0.gguf | Q5_0 | 1.75GB |
| gemma2-2b-ner.Q5_K_S.gguf | Q5_K_S | 1.75GB |
| gemma2-2b-ner.Q5_K.gguf | Q5_K | 1.79GB |
| gemma2-2b-ner.Q5_K_M.gguf | Q5_K_M | 1.79GB |
| gemma2-2b-ner.Q5_1.gguf | Q5_1 | 1.87GB |
| gemma2-2b-ner.Q6_K.gguf | Q6_K | 2.0GB |
| gemma2-2b-ner.Q8_0.gguf | Q8_0 | 2.59GB |
| 版次 | 資料量 | 準確率(Precision) | 召回率(Recall) |
|---|---|---|---|
| v1 | 979 | 0.272727273 | 0.218623482 |
| v2 | 1538 | 0.725888325 | 0.581300813 |
| v3 | 1886 | 0.717277487 | 0.465986395 |
| v4 | 2173 | 0.826086957 | 0.550724638 |
| v5 | 2577 | 0.983606557 | 0.75 |
from colorama import Fore, Back, Style
elements = {'LEO_SOC': ('犯罪主體', 'Subject of Crime'),
'LEO_VIC': ('客體', 'Victim'),
'LEO_ACT': ('不法行為', 'Behavior'),
'LEO_SLE': ('主觀要件', 'Subjective Legal Element of the Offense'),
'LEO_CAU': ('因果關係', 'Causation'),
'LEO_ROH': ('危害結果', 'Result of Hazard'),
'LEO_ATP': ('未遂', 'Attempted')
}
tag_color = {'LEO_SOC': Fore.BLACK + Back.RED,
'LEO_VIC': Fore.BLACK + Back.YELLOW,
'LEO_ACT': Fore.BLACK + Back.GREEN,
'LEO_SLE': Fore.BLACK + Back.MAGENTA,
'LEO_CAU': Fore.BLACK + Back.CYAN,
'LEO_ROH': Fore.BLACK + Back.BLUE,
'LEO_ATP': Fore.WHITE + Back.BLACK,
}
from colorama import Fore, Back, Style
def tag_in_color(response_content, tag):
'''
說明:
將標註結果依照標籤進行標色。
Parameters:
response_content (str): 已經標註完畢並有標籤的內容。
tag (str): 標籤名稱,英文,沒有括號。
Return:
result (str): 去除標籤並含有 colorama 標色符號的字串。
'''
response_head = response_content.split("標註結果:\n")[0]
response_body = response_content.split("標註結果:\n")[1]
start_index = 0
# 使用正規表示式找出所有構成要件要素文字的起始位置
# 加入 re.escape() 是為了避免處理到有逸脱字元的字串會報錯而中斷程式執行
findall_open_tags = [m.start() for m in re.finditer(re.escape(f"[{tag}]"), response_body)]
findall_close_tags = [m.start() for m in re.finditer(re.escape(f"[/{tag}]"), response_body)]
try:
parts = [response_body[start_index:findall_open_tags[0]]] # 第一個標籤之前的句子
except IndexError:
parts = []
# 找出每個標籤所在位置,取出標籤文字並加以著色。
for j, idx in enumerate(findall_open_tags):
tag_text = response_body[idx + len(tag) + 2:findall_close_tags[j]]
parts.append(f"{tag_color[tag]}" + tag_text + Style.RESET_ALL) # 標籤內文字著色
closed_tag = findall_close_tags[j] + len(tag) + 3
try:
next_open_tag = findall_open_tags[j+1]
parts.append(response_body[closed_tag: next_open_tag]) # 結束標籤之後到下一個標籤前的文字
except IndexError:
parts.append(response_body[findall_close_tags[-1] + len(tag) + 3 :]) # 加入最後一句
result = ''
for _, part in enumerate(parts):
result = result + part
if result == '':
color_result = f"{tag_color[tag]}{tag}" + Fore.RESET + Back.RESET + " " +Fore.YELLOW + Back.RED + "*** 無標註結果 ***" + Fore.RESET + Back.RESET
else:
color_result = Fore.RED + Back.YELLOW + "標註著色結果:\n" + Fore.RESET + Back.RESET + result
return color_result