updates
This commit is contained in:
19
Backend/venv/lib/python3.12/site-packages/nltk/lm/util.py
Normal file
19
Backend/venv/lib/python3.12/site-packages/nltk/lm/util.py
Normal file
@@ -0,0 +1,19 @@
|
||||
# Natural Language Toolkit
|
||||
#
|
||||
# Copyright (C) 2001-2025 NLTK Project
|
||||
# Author: Ilia Kurenkov <ilia.kurenkov@gmail.com>
|
||||
# URL: <https://www.nltk.org/>
|
||||
# For license information, see LICENSE.TXT
|
||||
"""Language Model Utilities"""
|
||||
|
||||
from math import log
|
||||
|
||||
NEG_INF = float("-inf")
|
||||
POS_INF = float("inf")
|
||||
|
||||
|
||||
def log_base2(score):
|
||||
"""Convenience function for computing logarithms with base 2."""
|
||||
if score == 0.0:
|
||||
return NEG_INF
|
||||
return log(score, 2)
|
||||
Reference in New Issue
Block a user