Skip to content

Commit

Permalink
Merge pull request #195 from bab2min/dev_12_4
Browse files Browse the repository at this point in the history
Dev 0.12.4
  • Loading branch information
bab2min authored Jan 22, 2023
2 parents 933aeae + 7024563 commit 5982907
Show file tree
Hide file tree
Showing 9 changed files with 47 additions and 3 deletions.
7 changes: 7 additions & 0 deletions README.kr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -305,6 +305,13 @@ tomotopy의 Python3 예제 코드는 https://github.com/bab2min/tomotopy/blob/ma

역사
-------
* 0.12.4 (2023-01-22)
* New features
* macOS ARM64 아키텍처에 대한 지원을 추가했습니다.
* Bug fixes
* `tomotopy.Document.get_sub_topic_dist()`가 bad argument 예외를 발생시키는 문제를 해결했습니다.
* 예외 발생이 종종 크래시를 발생시키는 문제를 해결했습니다.

* 0.12.3 (2022-07-19)
* 기능 개선
* 이제 `tomotopy.LDAModel.add_doc()`로 빈 문서를 삽입할 경우 예외를 발생시키는 대신 그냥 무시합니다. 새로 추가된 인자인 `ignore_empty_words`를 False로 설정할 경우 이전처럼 예외를 발생시킵니다.
Expand Down
7 changes: 7 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,13 @@ meaning you can use it for any reasonable purpose and remain in complete ownersh

History
-------
* 0.12.4 (2023-01-22)
* New features
* Added support for macOS ARM64 architecture.
* Bug fixes
* Fixed an issue where `tomotopy.Document.get_sub_topic_dist()` raises a bad argument exception.
* Fixed an issue where exception raising sometimes causes crashes.

* 0.12.3 (2022-07-19)
* New features
* Now, inserting an empty document using `tomotopy.LDAModel.add_doc()` just ignores it instead of raising an exception. If the newly added argument `ignore_empty_words` is set to False, an exception is raised as before.
Expand Down
3 changes: 2 additions & 1 deletion document/document_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@
<a class="homelink" rel="home" title="tomotopy Home" href="/tomotopy" style="display:block; font-size:2em; font-weight:bold; color:#555; padding-bottom:.5em; border-bottom:1px solid silver;"> <img src="/tomotopy/tomoto.png" alt="" style="height:1.5em;"> tomotopy </a>
<a id='lang-en' href="../en/index.html">English</a> <a id='lang-kr' href="../kr/index.html">한국어</a>
<div id="version-link">
<span>v0.12.3</span>
<span>v0.12.4</span>
<ul>
<li><a href='/tomotopy/v0.12.4/en'>v0.12.4</a></li>
<li><a href='/tomotopy/v0.12.3/en'>v0.12.3</a></li>
<li><a href='/tomotopy/v0.12.2/en'>v0.12.2</a></li>
<li><a href='/tomotopy/v0.12.1/en'>v0.12.1</a></li>
Expand Down
6 changes: 6 additions & 0 deletions src/python/PyUtils.h
Original file line number Diff line number Diff line change
Expand Up @@ -1313,6 +1313,7 @@ namespace py
{
PyObject* exc, * val, * tb, * val2;
PyErr_Fetch(&exc, &val, &tb);
PyErr_NormalizeException(&exc, &val, &tb);
if (tb)
{
PyException_SetTraceback(val, tb);
Expand All @@ -1321,7 +1322,9 @@ namespace py
Py_DECREF(exc);
PyObject* et = e.pytype();
val2 = PyObject_CallFunctionObjArgs(et, py::UniqueObj{ buildPyValue(e.what()) }.get(), nullptr);
Py_INCREF(val);
PyException_SetCause(val2, val);
PyException_SetContext(val2, val);
PyErr_SetObject(et, val2);
Py_DECREF(val2);
}
Expand Down Expand Up @@ -1355,6 +1358,7 @@ namespace py
{
PyObject* exc, * val, * tb, * val2;
PyErr_Fetch(&exc, &val, &tb);
PyErr_NormalizeException(&exc, &val, &tb);
if (tb)
{
PyException_SetTraceback(val, tb);
Expand All @@ -1363,7 +1367,9 @@ namespace py
Py_DECREF(exc);
PyObject* et = e.pytype();
val2 = PyObject_CallFunctionObjArgs(et, py::UniqueObj{ buildPyValue(e.what()) }.get(), nullptr);
Py_INCREF(val);
PyException_SetCause(val2, val);
PyException_SetContext(val2, val);
PyErr_SetObject(et, val2);
Py_DECREF(val2);
}
Expand Down
2 changes: 1 addition & 1 deletion src/python/py_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1197,7 +1197,7 @@ static PyMethodDef UtilsDocument_methods[] =
{ "get_topic_dist", (PyCFunction)Document_getTopicDist, METH_VARARGS | METH_KEYWORDS, Document_get_topic_dist__doc__ },
#ifdef TM_PA
{ "get_sub_topics", (PyCFunction)Document_getSubTopics, METH_VARARGS | METH_KEYWORDS, Document_get_sub_topics__doc__ },
{ "get_sub_topic_dist", (PyCFunction)Document_getSubTopicDist, METH_NOARGS, Document_get_sub_topic_dist__doc__ },
{ "get_sub_topic_dist", (PyCFunction)Document_getSubTopicDist, METH_VARARGS | METH_KEYWORDS, Document_get_sub_topic_dist__doc__ },
#endif
{ "get_words", (PyCFunction)Document_getWords, METH_VARARGS | METH_KEYWORDS, Document_get_words__doc__ },
{ "get_count_vector", (PyCFunction)Document_getCountVector, METH_NOARGS, Document_get_count_vector__doc__ },
Expand Down
9 changes: 9 additions & 0 deletions test/unit_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,15 @@ def infer_together(cls, inputFile, mdFields, f, kargs, ps):

mdl.infer(unseen_docs, parallel=ps, together=True)

def test_issue_187_crash_exc():
mdl = tp.LDAModel(k=10)
exc = None
try:
mdl.add_doc([[0, 1]])
except Exception as e:
exc = e
assert isinstance(exc, ValueError)

def train_raw_corpus(cls, inputFile, mdFields, f, kargs, ps):
print('Test train with raw corpus')
from nltk.stem.porter import PorterStemmer
Expand Down
2 changes: 1 addition & 1 deletion tomotopy/_version.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '0.12.3'
__version__ = '0.12.4'
7 changes: 7 additions & 0 deletions tomotopy/documentation.kr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,13 @@ tomotopy의 Python3 예제 코드는 https://github.com/bab2min/tomotopy/blob/ma

역사
-------
* 0.12.4 (2023-01-22)
* New features
* macOS ARM64 아키텍처에 대한 지원을 추가했습니다.
* Bug fixes
* `tomotopy.Document.get_sub_topic_dist()`가 bad argument 예외를 발생시키는 문제를 해결했습니다.
* 예외 발생이 종종 크래시를 발생시키는 문제를 해결했습니다.

* 0.12.3 (2022-07-19)
* 기능 개선
* 이제 `tomotopy.LDAModel.add_doc()`로 빈 문서를 삽입할 경우 예외를 발생시키는 대신 그냥 무시합니다. 새로 추가된 인자인 `ignore_empty_words`를 False로 설정할 경우 이전처럼 예외를 발생시킵니다.
Expand Down
7 changes: 7 additions & 0 deletions tomotopy/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -389,6 +389,13 @@ meaning you can use it for any reasonable purpose and remain in complete ownersh

History
-------
* 0.12.4 (2023-01-22)
* New features
* Added support for macOS ARM64 architecture.
* Bug fixes
* Fixed an issue where `tomotopy.Document.get_sub_topic_dist()` raises a bad argument exception.
* Fixed an issue where exception raising sometimes causes crashes.

* 0.12.3 (2022-07-19)
* New features
* Now, inserting an empty document using `tomotopy.LDAModel.add_doc()` just ignores it instead of raising an exception. If the newly added argument `ignore_empty_words` is set to False, an exception is raised as before.
Expand Down

0 comments on commit 5982907

Please sign in to comment.