Fix cpplint
This commit is contained in:
parent
e892628492
commit
ea477d6c5b
|
@ -25,8 +25,8 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Bigram_h
|
#ifndef BIGRAM_H_
|
||||||
#define Bigram_h
|
#define BIGRAM_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -25,9 +25,10 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef BlockReadingBuilder_h
|
#ifndef BLOCKREADINGBUILDER_H_
|
||||||
#define BlockReadingBuilder_h
|
#define BLOCKREADINGBUILDER_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Grid.h"
|
#include "Grid.h"
|
||||||
|
@ -38,7 +39,7 @@ namespace Gramambular {
|
||||||
|
|
||||||
class BlockReadingBuilder {
|
class BlockReadingBuilder {
|
||||||
public:
|
public:
|
||||||
BlockReadingBuilder(LanguageModel* lm);
|
explicit BlockReadingBuilder(LanguageModel* lm);
|
||||||
void clear();
|
void clear();
|
||||||
|
|
||||||
size_t length() const;
|
size_t length() const;
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Gramambular_h
|
#ifndef GRAMAMBULAR_H_
|
||||||
#define Gramambular_h
|
#define GRAMAMBULAR_H_
|
||||||
|
|
||||||
#include "Bigram.h"
|
#include "Bigram.h"
|
||||||
#include "BlockReadingBuilder.h"
|
#include "BlockReadingBuilder.h"
|
||||||
|
|
|
@ -35,9 +35,9 @@ std::string Grid::dumpDOT() {
|
||||||
sst << "graph [ rankdir=LR ];" << std::endl;
|
sst << "graph [ rankdir=LR ];" << std::endl;
|
||||||
sst << "BOS;" << std::endl;
|
sst << "BOS;" << std::endl;
|
||||||
|
|
||||||
for (unsigned long p = 0; p < m_spans.size(); p++) {
|
for (size_t p = 0; p < m_spans.size(); p++) {
|
||||||
Span& span = m_spans[p];
|
Span& span = m_spans[p];
|
||||||
for (unsigned long ni = 0; ni <= span.maximumLength(); ni++) {
|
for (size_t ni = 0; ni <= span.maximumLength(); ni++) {
|
||||||
Node* np = span.nodeOfLength(ni);
|
Node* np = span.nodeOfLength(ni);
|
||||||
if (np) {
|
if (np) {
|
||||||
if (!p) {
|
if (!p) {
|
||||||
|
@ -48,7 +48,7 @@ std::string Grid::dumpDOT() {
|
||||||
|
|
||||||
if (p + ni < m_spans.size()) {
|
if (p + ni < m_spans.size()) {
|
||||||
Span& dstSpan = m_spans[p + ni];
|
Span& dstSpan = m_spans[p + ni];
|
||||||
for (unsigned long q = 0; q <= dstSpan.maximumLength(); q++) {
|
for (size_t q = 0; q <= dstSpan.maximumLength(); q++) {
|
||||||
Node* dn = dstSpan.nodeOfLength(q);
|
Node* dn = dstSpan.nodeOfLength(q);
|
||||||
if (dn) {
|
if (dn) {
|
||||||
sst << np->currentKeyValue().value << " -> "
|
sst << np->currentKeyValue().value << " -> "
|
||||||
|
|
|
@ -25,10 +25,12 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Grid_h
|
#ifndef GRID_H_
|
||||||
#define Grid_h
|
#define GRID_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "NodeAnchor.h"
|
#include "NodeAnchor.h"
|
||||||
#include "Span.h"
|
#include "Span.h"
|
||||||
|
@ -198,7 +200,6 @@ inline NodeAnchor Grid::fixNodeSelectedCandidate(size_t location,
|
||||||
const_cast<Node*>(nodeAnchor.node)->selectCandidateAtIndex(i);
|
const_cast<Node*>(nodeAnchor.node)->selectCandidateAtIndex(i);
|
||||||
node = nodeAnchor;
|
node = nodeAnchor;
|
||||||
break;
|
break;
|
||||||
;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef KeyValuePair_h
|
#ifndef KEYVALUEPAIR_H_
|
||||||
#define KeyValuePair_h
|
#define KEYVALUEPAIR_H_
|
||||||
|
|
||||||
#include <ostream>
|
#include <ostream>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
|
|
@ -25,9 +25,10 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef LanguageModel_h
|
#ifndef LANGUAGEMODEL_H_
|
||||||
#define LanguageModel_h
|
#define LANGUAGEMODEL_H_
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "Bigram.h"
|
#include "Bigram.h"
|
||||||
|
|
|
@ -25,10 +25,12 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Node_h
|
#ifndef NODE_H_
|
||||||
#define Node_h
|
#define NODE_H_
|
||||||
|
|
||||||
#include <limits>
|
#include <limits>
|
||||||
|
#include <map>
|
||||||
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
#include "LanguageModel.h"
|
#include "LanguageModel.h"
|
||||||
|
@ -53,7 +55,7 @@ class Node {
|
||||||
|
|
||||||
const std::string& key() const;
|
const std::string& key() const;
|
||||||
double score() const;
|
double score() const;
|
||||||
double scoreForCandidate(std::string& candidate) const;
|
double scoreForCandidate(const std::string& candidate) const;
|
||||||
const KeyValuePair currentKeyValue() const;
|
const KeyValuePair currentKeyValue() const;
|
||||||
double highestUnigramScore() const;
|
double highestUnigramScore() const;
|
||||||
|
|
||||||
|
@ -190,7 +192,7 @@ inline const std::string& Node::key() const { return m_key; }
|
||||||
|
|
||||||
inline double Node::score() const { return m_score; }
|
inline double Node::score() const { return m_score; }
|
||||||
|
|
||||||
inline double Node::scoreForCandidate(std::string& candidate) const {
|
inline double Node::scoreForCandidate(const std::string& candidate) const {
|
||||||
for (auto unigram : m_unigrams) {
|
for (auto unigram : m_unigrams) {
|
||||||
if (unigram.keyValue.value == candidate) {
|
if (unigram.keyValue.value == candidate) {
|
||||||
return unigram.score;
|
return unigram.score;
|
||||||
|
|
|
@ -25,8 +25,10 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef NodeAnchor_h
|
#ifndef NODEANCHOR_H_
|
||||||
#define NodeAnchor_h
|
#define NODEANCHOR_H_
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "Node.h"
|
#include "Node.h"
|
||||||
|
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Span_h
|
#ifndef SPAN_H_
|
||||||
#define Span_h
|
#define SPAN_H_
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <set>
|
#include <set>
|
||||||
|
|
|
@ -25,8 +25,8 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Unigram_h
|
#ifndef UNIGRAM_H_
|
||||||
#define Unigram_h
|
#define UNIGRAM_H_
|
||||||
|
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
|
|
@ -25,10 +25,11 @@
|
||||||
// OTHER DEALINGS IN THE SOFTWARE.
|
// OTHER DEALINGS IN THE SOFTWARE.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifndef Walker_h
|
#ifndef WALKER_H_
|
||||||
#define Walker_h
|
#define WALKER_H_
|
||||||
|
|
||||||
#include <algorithm>
|
#include <algorithm>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
#include "Grid.h"
|
#include "Grid.h"
|
||||||
|
|
||||||
|
@ -37,7 +38,7 @@ namespace Gramambular {
|
||||||
|
|
||||||
class Walker {
|
class Walker {
|
||||||
public:
|
public:
|
||||||
Walker(Grid* inGrid);
|
explicit Walker(Grid* inGrid);
|
||||||
const std::vector<NodeAnchor> reverseWalk(size_t location,
|
const std::vector<NodeAnchor> reverseWalk(size_t location,
|
||||||
double accumulatedScore = 0.0);
|
double accumulatedScore = 0.0);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue