GCC Code Coverage Report
Directory: . Exec Total Coverage
File: src/options/didyoumean.h Lines: 0 3 0.0 %
Date: 2021-05-22 Branches: 0 0 0.0 %

Line Exec Source
1
/******************************************************************************
2
 * Top contributors (to current version):
3
 *   Kshitij Bansal, Tim King
4
 *
5
 * This file is part of the cvc5 project.
6
 *
7
 * Copyright (c) 2009-2021 by the authors listed in the file AUTHORS
8
 * in the top-level source directory and their institutional affiliations.
9
 * All rights reserved.  See the file COPYING in the top-level source
10
 * directory for licensing information.
11
 * ****************************************************************************
12
 *
13
 * Did-you-mean style suggestions.
14
 *
15
 * ``What do you mean? I don't understand.'' An attempt to be more
16
 * helpful than that. Similar to one in git.
17
 *
18
 * There are no dependencies on cvc5 (except namespace).
19
 */
20
21
#pragma once
22
23
#include <set>
24
#include <string>
25
#include <vector>
26
27
namespace cvc5 {
28
29
class DidYouMean {
30
 public:
31
  using Words = std::set<std::string>;
32
33
  DidYouMean() {}
34
  ~DidYouMean() {}
35
36
  void addWord(std::string word) { d_words.insert(std::move(word)); }
37
38
  std::vector<std::string> getMatch(const std::string& input);
39
40
  /**
41
   * This is provided to make it easier to ensure consistency of
42
   * output. Returned string is empty if there are no matches.
43
   */
44
  std::string getMatchAsString(const std::string& input,
45
                               uint64_t prefixNewLines = 2,
46
                               uint64_t suffixNewLines = 0);
47
48
 private:
49
  int editDistance(const std::string& a, const std::string& b);
50
  Words d_words;
51
};
52
53
}  // namespace cvc5