Skip to content

Commit

Permalink
update docs & fixed grammar errors (#120)
Browse files Browse the repository at this point in the history
  • Loading branch information
bab2min committed Jun 20, 2021
1 parent dc962f7 commit 4e31344
Show file tree
Hide file tree
Showing 11 changed files with 41 additions and 17 deletions.
6 changes: 6 additions & 0 deletions README.kr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,12 @@ tomotopy의 Python3 예제 코드는 https://github.com/bab2min/tomotopy/blob/ma

역사
-------
* 0.12.1 (2021-06-20)
* `tomotopy.LDAModel.set_word_prior()`가 크래시를 발생시키던 문제를 해결했습니다.
* 이제 `tomotopy.LDAModel.perplexity`와 `tomotopy.LDAModel.ll_per_word`가 TermWeight가 ONE이 아닌 경우에도 정확한 값을 반환합니다.
* 용어가중치가 적용된 빈도수를 반환하는 `tomotopy.LDAModel.used_vocab_weighted_freq`가 추가되었습니다.
* 이제 `tomotopy.LDAModel.summary()`가 단어의 엔트로피뿐만 아니라, 용어 가중치가 적용된 단어의 엔트로피도 함께 보여줍니다.

* 0.12.0 (2021-04-26)
* 이제 `tomotopy.DMRModel`와 `tomotopy.GDMRModel`가 다중 메타데이터를 지원합니다. (https://github.com/bab2min/tomotopy/blob/main/examples/dmr_multi_label.py 참조)
* `tomotopy.GDMRModel`의 성능이 개선되었습니다.
Expand Down
6 changes: 6 additions & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@ meaning you can use it for any reasonable purpose and remain in complete ownersh

History
-------
* 0.12.1 (2021-06-20)
* An issue where `tomotopy.LDAModel.set_word_prior()` causes a crash has been fixed.
* Now `tomotopy.LDAModel.perplexity` and `tomotopy.LDAModel.ll_per_word` return the accurate value when `TermWeight` is not `ONE`.
* `tomotopy.LDAModel.used_vocab_weighted_freq` was added, which returns term-weighted frequencies of words.
* Now `tomotopy.LDAModel.summary()` shows not only the entropy of words, but also the entropy of term-weighted words.

* 0.12.0 (2021-04-26)
* Now `tomotopy.DMRModel` and `tomotopy.GDMRModel` support multiple values of metadata (see https://github.com/bab2min/tomotopy/blob/main/examples/dmr_multi_label.py )
* The performance of `tomotopy.GDMRModel` was improved.
Expand Down
2 changes: 1 addition & 1 deletion src/TopicModel/LDAModel.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1069,7 +1069,7 @@ namespace tomoto
++df[w];
}
}
totCf = accumulate(this->vocabCf.begin(), this->vocabCf.end(), 0);
totCf = std::accumulate(this->vocabCf.begin(), this->vocabCf.end(), 0);
}
if (_tw == TermWeight::idf)
{
Expand Down
4 changes: 2 additions & 2 deletions src/python/py_CT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ PyObject* Document_beta(DocumentObject* self, void* closure)
{
return py::handleExc([&]() -> PyObject*
{
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `beta` field!" };
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `beta` field!" };
if (!self->doc) throw py::RuntimeError{ "doc is null!" };

if (auto ret = docVisit<tomoto::DocumentCTM>(self->getBoundDoc(), [](auto* doc)
Expand All @@ -168,6 +168,6 @@ PyObject* Document_beta(DocumentObject* self, void* closure)
logf
);
})) return ret;
throw py::AttributeError{ "doc doesn't has `beta` field!" };
throw py::AttributeError{ "doc has no `beta` field!" };
});
}
2 changes: 1 addition & 1 deletion src/python/py_DMR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,7 @@ PyObject* Document_DMR_multiMetadata(DocumentObject* self, void* closure)
return inst->getMultiMetadataDict().toWord(x);
});
})) return ret;
throw py::AttributeError{ "doc doesn't has `multi_metadata` field!" };
throw py::AttributeError{ "doc has no `multi_metadata` field!" };
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/python/py_DT.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -277,15 +277,15 @@ PyObject* Document_eta(DocumentObject* self, void* closure)
{
return py::handleExc([&]() -> PyObject*
{
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `eta` field!" };
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `eta` field!" };
if (!self->doc) throw py::RuntimeError{ "doc is null!" };

if (auto* ret = docVisit<tomoto::DocumentDTM>(self->getBoundDoc(), [](auto* doc)
{
return py::buildPyValue(doc->eta.array().data(), doc->eta.array().data() + doc->eta.array().size());
})) return ret;

throw py::AttributeError{ "doc doesn't has `eta` field!" };
throw py::AttributeError{ "doc has no `eta` field!" };
});
}

Expand Down
4 changes: 2 additions & 2 deletions src/python/py_LLDA.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ PyObject* Document_labels(DocumentObject* self, void* closure)
{
return py::handleExc([&]()
{
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `labels` field!" };
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `labels` field!" };
if (!self->doc) throw py::RuntimeError{ "doc is null!" };

if (auto* ret = docVisit<tomoto::DocumentLLDA>(self->getBoundDoc(), [&](auto* doc)
Expand All @@ -146,7 +146,7 @@ PyObject* Document_labels(DocumentObject* self, void* closure)
return py::buildPyValue(r);
})) return ret;

throw py::AttributeError{ "doc doesn't has `labels` field!" };
throw py::AttributeError{ "doc has no `labels` field!" };
});
}

Expand Down
8 changes: 4 additions & 4 deletions src/python/py_utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1136,7 +1136,7 @@ static PyObject* Document_Z(DocumentObject* self, void* closure)
{
return py::handleExc([&]()
{
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `topics` field!" };
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `topics` field!" };
if (!self->doc) throw py::RuntimeError{ "doc is null!" };
#ifdef TM_HLDA
if (auto* ret = Document_HLDA_Z(self, closure)) return ret;
Expand All @@ -1145,20 +1145,20 @@ static PyObject* Document_Z(DocumentObject* self, void* closure)
if (auto* ret = Document_HDP_Z(self, closure)) return ret;
#endif
if (auto* ret = Document_LDA_Z(self, closure)) return ret;
throw py::AttributeError{ "doc doesn't has `topics` field!" };
throw py::AttributeError{ "doc has no `topics` field!" };
});
}

static PyObject* Document_metadata(DocumentObject* self, void* closure)
{
return py::handleExc([&]()
{
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `metadata` field!" };
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `metadata` field!" };
if (!self->doc) throw py::RuntimeError{ "doc is null!" };
#ifdef TM_DMR
if (auto* ret = Document_DMR_metadata(self, closure)) return ret;
#endif
throw py::AttributeError{ "doc doesn't has `metadata` field!" };
throw py::AttributeError{ "doc has no `metadata` field!" };
});
}

Expand Down
10 changes: 5 additions & 5 deletions src/python/utils.h
Original file line number Diff line number Diff line change
Expand Up @@ -254,13 +254,13 @@ PyObject* Document_##NAME(DocumentObject* self, void* closure)\
{\
return py::handleExc([&]()\
{\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `" #FIELD "` field!" };\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `" #FIELD "` field!" };\
if (!self->doc) throw py::RuntimeError{ "doc is null!" };\
if (auto* ret = docVisit<DOCTYPE>(self->getBoundDoc(), [](auto* doc)\
{\
return py::buildPyValue(doc->FIELD);\
})) return ret;\
throw py::AttributeError{ "doc doesn't has `" #FIELD "` field!" };\
throw py::AttributeError{ "doc has no `" #FIELD "` field!" };\
});\
}

Expand All @@ -269,7 +269,7 @@ PyObject* Document_##NAME(DocumentObject* self, void* closure)\
{\
return py::handleExc([&]()\
{\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `" #FIELD "` field!" };\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `" #FIELD "` field!" };\
if (!self->doc) throw py::RuntimeError{ "doc is null!" };\
return docVisit<DOCTYPE>(self->getBoundDoc(), [](auto* doc)\
{\
Expand All @@ -283,13 +283,13 @@ PyObject* Document_##NAME(DocumentObject* self, void* closure)\
{\
return py::handleExc([&]()\
{\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc doesn't has `" #FIELD "` field!" };\
if (self->corpus->isIndependent()) throw py::AttributeError{ "doc has no `" #FIELD "` field!" };\
if (!self->doc) throw py::RuntimeError{ "doc is null!" };\
if (auto* ret = docVisit<DOCTYPE>(self->getBoundDoc(), [](auto* doc)\
{\
return buildPyValueReorder(doc->FIELD, doc->wOrder);\
})) return ret;\
throw py::AttributeError{ "doc doesn't has `" #FIELD "` field!" }; \
throw py::AttributeError{ "doc has no `" #FIELD "` field!" }; \
});\
}

Expand Down
6 changes: 6 additions & 0 deletions tomotopy/documentation.kr.rst
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,12 @@ tomotopy의 Python3 예제 코드는 https://github.com/bab2min/tomotopy/blob/ma

역사
-------
* 0.12.1 (2021-06-20)
* `tomotopy.LDAModel.set_word_prior()`가 크래시를 발생시키던 문제를 해결했습니다.
* 이제 `tomotopy.LDAModel.perplexity`와 `tomotopy.LDAModel.ll_per_word`가 TermWeight가 ONE이 아닌 경우에도 정확한 값을 반환합니다.
* 용어가중치가 적용된 빈도수를 반환하는 `tomotopy.LDAModel.used_vocab_weighted_freq`가 추가되었습니다.
* 이제 `tomotopy.LDAModel.summary()`가 단어의 엔트로피뿐만 아니라, 용어 가중치가 적용된 단어의 엔트로피도 함께 보여줍니다.

* 0.12.0 (2021-04-26)
* 이제 `tomotopy.DMRModel`와 `tomotopy.GDMRModel`가 다중 메타데이터를 지원합니다. (https://github.com/bab2min/tomotopy/blob/main/examples/dmr_multi_label.py 참조)
* `tomotopy.GDMRModel`의 성능이 개선되었습니다.
Expand Down
6 changes: 6 additions & 0 deletions tomotopy/documentation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,12 @@ meaning you can use it for any reasonable purpose and remain in complete ownersh

History
-------
* 0.12.1 (2021-06-20)
* An issue where `tomotopy.LDAModel.set_word_prior()` causes a crash has been fixed.
* Now `tomotopy.LDAModel.perplexity` and `tomotopy.LDAModel.ll_per_word` return the accurate value when `TermWeight` is not `ONE`.
* `tomotopy.LDAModel.used_vocab_weighted_freq` was added, which returns term-weighted frequencies of words.
* Now `tomotopy.LDAModel.summary()` shows not only the entropy of words, but also the entropy of term-weighted words.

* 0.12.0 (2021-04-26)
* Now `tomotopy.DMRModel` and `tomotopy.GDMRModel` support multiple values of metadata (see https://github.com/bab2min/tomotopy/blob/main/examples/dmr_multi_label.py )
* The performance of `tomotopy.GDMRModel` was improved.
Expand Down

0 comments on commit 4e31344

Please sign in to comment.