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

Line Exec Source
1
/*********************                                                        */
2
/*! \file didyoumean.h
3
 ** \verbatim
4
 ** Top contributors (to current version):
5
 **   Kshitij Bansal, Tim King
6
 ** This file is part of the CVC4 project.
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.\endverbatim
11
 **
12
 ** \brief did-you-mean style suggestions.
13
 **
14
 ** ``What do you mean? I don't understand.'' An attempt to be more
15
 ** helpful than that. Similar to one in git.
16
 **
17
 ** There are no dependencies on CVC4 (except namespace).
18
 **/
19
20
#pragma once
21
22
#include <set>
23
#include <string>
24
#include <vector>
25
26
namespace CVC4 {
27
28
class DidYouMean {
29
 public:
30
  typedef std::set<std::string> Words;
31
32
  DidYouMean() {}
33
  ~DidYouMean() {}
34
35
  DidYouMean(Words words) : d_words(words) {}
36
37
  void addWord(std::string word) { d_words.insert(word); }
38
39
  std::vector<std::string> getMatch(std::string input);
40
41
  /**
42
   * This is provided to make it easier to ensure consistency of
43
   * output. Returned string is empty if there are no matches.
44
   */
45
  std::string getMatchAsString(std::string input, int prefixNewLines = 2,
46
                               int suffixNewLines = 0);
47
48
 private:
49
  int editDistance(const std::string& a, const std::string& b);
50
  Words d_words;
51
};
52
53
} /*CVC4 namespace*/