Fix cpplint

This commit is contained in:
Lukhnos Liu 2022-02-19 10:22:24 -08:00
parent e892628492
commit ea477d6c5b
12 changed files with 38 additions and 30 deletions

View File

@ -25,8 +25,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Bigram_h
#define Bigram_h
#ifndef BIGRAM_H_
#define BIGRAM_H_
#include <vector>

View File

@ -25,9 +25,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef BlockReadingBuilder_h
#define BlockReadingBuilder_h
#ifndef BLOCKREADINGBUILDER_H_
#define BLOCKREADINGBUILDER_H_
#include <string>
#include <vector>
#include "Grid.h"
@ -38,7 +39,7 @@ namespace Gramambular {
class BlockReadingBuilder {
public:
BlockReadingBuilder(LanguageModel* lm);
explicit BlockReadingBuilder(LanguageModel* lm);
void clear();
size_t length() const;

View File

@ -25,8 +25,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Gramambular_h
#define Gramambular_h
#ifndef GRAMAMBULAR_H_
#define GRAMAMBULAR_H_
#include "Bigram.h"
#include "BlockReadingBuilder.h"

View File

@ -35,9 +35,9 @@ std::string Grid::dumpDOT() {
sst << "graph [ rankdir=LR ];" << 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];
for (unsigned long ni = 0; ni <= span.maximumLength(); ni++) {
for (size_t ni = 0; ni <= span.maximumLength(); ni++) {
Node* np = span.nodeOfLength(ni);
if (np) {
if (!p) {
@ -48,7 +48,7 @@ std::string Grid::dumpDOT() {
if (p + ni < m_spans.size()) {
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);
if (dn) {
sst << np->currentKeyValue().value << " -> "

View File

@ -25,10 +25,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Grid_h
#define Grid_h
#ifndef GRID_H_
#define GRID_H_
#include <map>
#include <string>
#include <vector>
#include "NodeAnchor.h"
#include "Span.h"
@ -198,7 +200,6 @@ inline NodeAnchor Grid::fixNodeSelectedCandidate(size_t location,
const_cast<Node*>(nodeAnchor.node)->selectCandidateAtIndex(i);
node = nodeAnchor;
break;
;
}
}
}

View File

@ -25,8 +25,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef KeyValuePair_h
#define KeyValuePair_h
#ifndef KEYVALUEPAIR_H_
#define KEYVALUEPAIR_H_
#include <ostream>
#include <string>

View File

@ -25,9 +25,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef LanguageModel_h
#define LanguageModel_h
#ifndef LANGUAGEMODEL_H_
#define LANGUAGEMODEL_H_
#include <string>
#include <vector>
#include "Bigram.h"

View File

@ -25,10 +25,12 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Node_h
#define Node_h
#ifndef NODE_H_
#define NODE_H_
#include <limits>
#include <map>
#include <string>
#include <vector>
#include "LanguageModel.h"
@ -53,7 +55,7 @@ class Node {
const std::string& key() const;
double score() const;
double scoreForCandidate(std::string& candidate) const;
double scoreForCandidate(const std::string& candidate) const;
const KeyValuePair currentKeyValue() 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::scoreForCandidate(std::string& candidate) const {
inline double Node::scoreForCandidate(const std::string& candidate) const {
for (auto unigram : m_unigrams) {
if (unigram.keyValue.value == candidate) {
return unigram.score;

View File

@ -25,8 +25,10 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef NodeAnchor_h
#define NodeAnchor_h
#ifndef NODEANCHOR_H_
#define NODEANCHOR_H_
#include <vector>
#include "Node.h"

View File

@ -25,8 +25,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Span_h
#define Span_h
#ifndef SPAN_H_
#define SPAN_H_
#include <map>
#include <set>

View File

@ -25,8 +25,8 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Unigram_h
#define Unigram_h
#ifndef UNIGRAM_H_
#define UNIGRAM_H_
#include <vector>

View File

@ -25,10 +25,11 @@
// OTHER DEALINGS IN THE SOFTWARE.
//
#ifndef Walker_h
#define Walker_h
#ifndef WALKER_H_
#define WALKER_H_
#include <algorithm>
#include <vector>
#include "Grid.h"
@ -37,7 +38,7 @@ namespace Gramambular {
class Walker {
public:
Walker(Grid* inGrid);
explicit Walker(Grid* inGrid);
const std::vector<NodeAnchor> reverseWalk(size_t location,
double accumulatedScore = 0.0);