Skip to content

Commit

Permalink
Fix serialization method for FDs
Browse files Browse the repository at this point in the history
  • Loading branch information
vs9h authored and polyntsov committed Aug 11, 2023
1 parent 00964c1 commit 314cd96
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion src/core/algorithms/fd/fd.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class FD {
FD(Vertical const& lhs, Column const& rhs) : lhs_(lhs), rhs_(rhs) {}

std::string ToJSONString() const {
return "{lhs: " + lhs_.ToIndicesString() + ", rhs: " + rhs_.ToIndicesString() + "}";
return "{\"lhs\": " + lhs_.ToIndicesString() + ", \"rhs\": " + rhs_.ToIndicesString() + "}";
}

Vertical const& GetLhs() const {
Expand Down
34 changes: 17 additions & 17 deletions src/tests/datasets.h
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,17 @@ struct Dataset {
class LightDatasets {
public:
static inline const std::array<Dataset, 11> datasets_ = {
{{"CIPublicHighway10k.csv", 21537, ',', true},
{"neighbors10k.csv", 62210, ',', true},
{"WDC_astronomical.csv", 49417, ',', true},
{"WDC_age.csv", 44913, ',', true},
{"WDC_appearances.csv", 34497, ',', true},
{"WDC_astrology.csv", 12109, ',', true},
{"WDC_game.csv", 32103, ',', true},
{"WDC_science.csv", 44913, ',', true},
{"WDC_symbols.csv", 2160, ',', true},
{"breast_cancer.csv", 58641, ',', true},
{"WDC_kepler.csv", 6284, ',', true}}};
{{"CIPublicHighway10k.csv", 33398, ',', true},
{"neighbors10k.csv", 43368, ',', true},
{"WDC_astronomical.csv", 22281, ',', true},
{"WDC_age.csv", 19620, ',', true},
{"WDC_appearances.csv", 25827, ',', true},
{"WDC_astrology.csv", 40815, ',', true},
{"WDC_game.csv", 6418, ',', true},
{"WDC_science.csv", 19620, ',', true},
{"WDC_symbols.csv", 28289, ',', true},
{"breast_cancer.csv", 15121, ',', true},
{"WDC_kepler.csv", 63730, ',', true}}};

// DEPRECATED -- just use
// for (auto dataset : LightDatasets::datasets) { ... }
Expand All @@ -50,12 +50,12 @@ class LightDatasets {
class HeavyDatasets {
public:
static inline const std::array<Dataset, 6> datasets_ = {
{{"adult.csv", 20873, ';', false},
{"CIPublicHighway.csv", 32696, ',', true},
{"EpicMeds.csv", 19617, '|', true},
{"EpicVitals.csv", 24082, '|', true},
{"iowa1kk.csv", 55285, ',', true},
{"LegacyPayors.csv", 34874, '|', true}}};
{{"adult.csv", 23075, ';', false},
{"CIPublicHighway.csv", 13035, ',', true},
{"EpicMeds.csv", 50218, '|', true},
{"EpicVitals.csv", 2083, '|', true},
{"iowa1kk.csv", 28573, ',', true},
{"LegacyPayors.csv", 43612, '|', true}}};

// DEPRECATED -- just use
// for (auto dataset : HeavyDatasets::datasets) { ... }
Expand Down
4 changes: 2 additions & 2 deletions src/tests/test_typo_miner.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,15 +99,15 @@ static std::string MakeJsonFromFds(std::vector<FdByIndices> const& fds) {
std::string json_fds = "{\"fds\": [";

for (FdByIndices const& fd : fds) {
json_fds += "{lhs: [";
json_fds += "{\"lhs\": [";
auto last = std::prev(fd.end());
for (auto it = fd.begin(); it != last; ++it) {
json_fds += std::to_string(*it);
if (std::next(it) != last) {
json_fds += ", ";
}
}
json_fds += "], rhs: ";
json_fds += "], \"rhs\": ";
assert(!fd.empty());
json_fds += std::to_string(fd.back());
json_fds += "},";
Expand Down

0 comments on commit 314cd96

Please sign in to comment.