Skip to content

Commit

Permalink
chris edits
Browse files Browse the repository at this point in the history
  • Loading branch information
Chris Dyer committed Mar 18, 2014
1 parent 7666293 commit 3a5aeb6
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 4 deletions.
4 changes: 4 additions & 0 deletions corpus/support/tokenizer.pl
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@ sub proc_token {
return $token;
}

if($token =~ /^\d+(.\d+)+(亿|百万|万|千)?$/){
return $token;
}

## 1,234,345.34
if($token =~ /^\d+(\.\d{3})*,\d+$/){
## number
Expand Down
2 changes: 1 addition & 1 deletion utils/exp_semiring.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ const PRPair<P,R> operator*(const PRPair<P,R>& a, const PRPair<P,R>& b) {
}

template <class P, class R>
const PRPair<P,R> star(const PRPair<P,R>& x) {
inline const PRPair<P,R> star(const PRPair<P,R>& x) {
const P pstar = star(x.p);
return PRPair<P,R>(pstar, pstar * x.r * pstar);
}
Expand Down
2 changes: 1 addition & 1 deletion utils/logval.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ template <class T>
std::size_t hash_value(const LogVal<T>& x) { return x.hash_impl(); }

template <class T>
LogVal<T> star(LogVal<T> x) {
inline LogVal<T> star(LogVal<T> x) {
if (x.is_0()) return x;
if (x.v_ >= 0) {
x.v_ = std::numeric_limits<T>::infinity();
Expand Down
4 changes: 2 additions & 2 deletions utils/star.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@
// star(x) computes the infinite sum x^0 + x^1 + x^2 + ...

template <typename T>
T star(const T& x) {
inline T star(const T& x) {
if (!x) return T();
if (x > T(1)) return std::numeric_limits<T>::infinity();
if (x < -T(1)) return -std::numeric_limits<T>::infinity();
return T(1) / (T(1) - x);
}

bool star(bool x) {
inline bool star(bool x) {
return x;
}

Expand Down

0 comments on commit 3a5aeb6

Please sign in to comment.