-
-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove dependency on protocol buffers
- Loading branch information
1 parent
51a2dff
commit 50b0270
Showing
6 changed files
with
245 additions
and
21 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
/* Copyright 2022 Akihiko Odaki <akihiko.odaki@gmail.com> | ||
All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
==============================================================================*/ | ||
|
||
#ifndef FEATURE_EXTRACTOR_PB_H_ | ||
#define FEATURE_EXTRACTOR_PB_H_ | ||
|
||
#include <cstdint> | ||
#include <string> | ||
#include <vector> | ||
|
||
namespace chrome_lang_id { | ||
|
||
class Parameter { | ||
public: | ||
const std::string& name() const { return name_; } | ||
void set_name(std::string value) { name_ = std::move(value); } | ||
const std::string& value() const { return value_; } | ||
void set_value(std::string value) { value_ = std::move(value); } | ||
|
||
private: | ||
std::string name_; | ||
std::string value_; | ||
}; | ||
|
||
class FeatureFunctionDescriptor { | ||
public: | ||
const std::string& type() const { return type_; } | ||
|
||
void set_type(std::string value) { type_ = std::move(value); } | ||
|
||
const std::string& name() const { return name_; } | ||
|
||
void set_name(std::string value) { name_ = std::move(value); } | ||
|
||
bool has_argument() const { return true; } | ||
|
||
std::int32_t argument() const { return argument_; } | ||
|
||
void set_argument(int32_t value) { argument_ = value; } | ||
|
||
int parameter_size() const { return parameter_.size(); } | ||
|
||
const Parameter& parameter(int index) const { return parameter_[index]; } | ||
|
||
Parameter* add_parameter() { return ¶meter_.emplace_back(); } | ||
|
||
int feature_size() const { return feature_.size(); } | ||
|
||
FeatureFunctionDescriptor* mutable_feature(int index) { | ||
return &feature_[index]; | ||
} | ||
|
||
const FeatureFunctionDescriptor& feature(int index) const { | ||
return feature_[index]; | ||
} | ||
|
||
FeatureFunctionDescriptor* add_feature() { return &feature_.emplace_back(); } | ||
|
||
private: | ||
std::string type_; | ||
std::string name_; | ||
std::int32_t argument_; | ||
std::vector<Parameter> parameter_; | ||
std::vector<FeatureFunctionDescriptor> feature_; | ||
}; | ||
|
||
class FeatureExtractorDescriptor { | ||
public: | ||
int feature_size() const { return feature_.size(); } | ||
|
||
FeatureFunctionDescriptor* mutable_feature(int index) { | ||
return &feature_[index]; | ||
} | ||
|
||
const FeatureFunctionDescriptor& feature(int index) const { | ||
return feature_[index]; | ||
} | ||
|
||
FeatureFunctionDescriptor* add_feature() { return &feature_.emplace_back(); } | ||
|
||
private: | ||
std::vector<FeatureFunctionDescriptor> feature_; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
/* Copyright 2022 Akihiko Odaki <akihiko.odaki@gmail.com> | ||
All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
==============================================================================*/ | ||
|
||
#ifndef SENTENCE_PB_H_ | ||
#define SENTENCE_PB_H_ | ||
|
||
#include <string> | ||
|
||
namespace chrome_lang_id { | ||
|
||
class Sentence { | ||
public: | ||
const std::string& text() const { return text_; } | ||
void set_text(std::string value) { text_ = std::move(value); } | ||
|
||
private: | ||
std::string text_; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
/* Copyright 2022 Akihiko Odaki <akihiko.odaki@gmail.com> | ||
All Rights Reserved. | ||
Licensed under the Apache License, Version 2.0 (the "License"); | ||
you may not use this file except in compliance with the License. | ||
You may obtain a copy of the License at | ||
http://www.apache.org/licenses/LICENSE-2.0 | ||
Unless required by applicable law or agreed to in writing, software | ||
distributed under the License is distributed on an "AS IS" BASIS, | ||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
See the License for the specific language governing permissions and | ||
limitations under the License. | ||
==============================================================================*/ | ||
|
||
#ifndef TASK_SPEC_PB_H_ | ||
#define TASK_SPEC_PB_H_ | ||
|
||
#include <string> | ||
#include <vector> | ||
|
||
namespace chrome_lang_id { | ||
|
||
class TaskInput { | ||
public: | ||
class Part { | ||
public: | ||
const std::string& file_pattern() const { return file_pattern_; } | ||
|
||
private: | ||
std::string file_pattern_; | ||
}; | ||
|
||
const std::string& name() const { return name_; } | ||
|
||
void set_name(std::string value) { name_ = value; } | ||
|
||
int file_format_size() const { return file_format_.size(); } | ||
|
||
const std::string& file_format(int index) const { | ||
return file_format_[index]; | ||
} | ||
|
||
void add_file_format(std::string value) { | ||
file_format_.push_back(std::move(value)); | ||
} | ||
|
||
int record_format_size() const { return record_format_.size(); } | ||
|
||
const std::string& record_format(int index) const { | ||
return record_format_[index]; | ||
} | ||
|
||
void add_record_format(std::string value) { | ||
record_format_.push_back(std::move(value)); | ||
} | ||
|
||
int part_size() const { return part_.size(); } | ||
const Part& part(int index) const { return part_[index]; } | ||
|
||
private: | ||
std::string name_; | ||
std::vector<std::string> file_format_; | ||
std::vector<std::string> record_format_; | ||
std::vector<Part> part_; | ||
}; | ||
|
||
class TaskSpec { | ||
public: | ||
class Parameter { | ||
public: | ||
const std::string& name() const { return name_; } | ||
void set_name(std::string value) { name_ = std::move(value); } | ||
const std::string& value() const { return value_; } | ||
void set_value(std::string value) { value_ = std::move(value); } | ||
|
||
private: | ||
std::string name_; | ||
std::string value_; | ||
}; | ||
|
||
int parameter_size() const { return parameter_.size(); } | ||
|
||
Parameter* mutable_parameter(int index) { return ¶meter_[index]; } | ||
|
||
const Parameter& parameter(int index) const { return parameter_[index]; } | ||
|
||
Parameter* add_parameter() { return ¶meter_.emplace_back(); } | ||
|
||
int input_size() const { return input_.size(); } | ||
|
||
TaskInput* mutable_input(int index) { return &input_[index]; } | ||
|
||
const TaskInput& input(int index) const { return input_[index]; } | ||
|
||
TaskInput* add_input() { return &input_.emplace_back(); } | ||
|
||
private: | ||
std::vector<Parameter> parameter_; | ||
std::vector<TaskInput> input_; | ||
}; | ||
|
||
} | ||
|
||
#endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters