Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
ediText
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Redmine
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
nlpworkers
ediText
Commits
e9a03129
Commit
e9a03129
authored
Aug 22, 2018
by
Igor Danielewicz
Browse files
Options
Downloads
Patches
Plain Diff
Removed Format function class
parent
4204e9b4
No related branches found
No related tags found
No related merge requests found
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
ConfigParser.cpp
+0
-2
0 additions, 2 deletions
ConfigParser.cpp
ConfigParser.hpp
+0
-1
0 additions, 1 deletion
ConfigParser.hpp
functions/Format.cpp
+0
-50
0 additions, 50 deletions
functions/Format.cpp
functions/Format.hpp
+0
-19
0 additions, 19 deletions
functions/Format.hpp
with
0 additions
and
72 deletions
ConfigParser.cpp
+
0
−
2
View file @
e9a03129
...
@@ -36,8 +36,6 @@ Function* ConfigParser::str2function(std::string name, ptree& config)
...
@@ -36,8 +36,6 @@ Function* ConfigParser::str2function(std::string name, ptree& config)
{
{
if
(
name
==
"replace"
)
if
(
name
==
"replace"
)
return
new
Replace
(
config
);
return
new
Replace
(
config
);
if
(
name
==
"format"
)
return
new
Format
(
config
);
else
else
return
nullptr
;
return
nullptr
;
}
}
...
...
This diff is collapsed.
Click to expand it.
ConfigParser.hpp
+
0
−
1
View file @
e9a03129
#pragma once
#pragma once
#include
"functions/Function.hpp"
#include
"functions/Function.hpp"
#include
"functions/Replace.hpp"
#include
"functions/Replace.hpp"
#include
"functions/Format.hpp"
#include
"textIterators/TextIterator.hpp"
#include
"textIterators/TextIterator.hpp"
#include
"textIterators/LineIterator.hpp"
#include
"textIterators/LineIterator.hpp"
#include
"textIterators/TokenIterator.hpp"
#include
"textIterators/TokenIterator.hpp"
...
...
This diff is collapsed.
Click to expand it.
functions/Format.cpp
deleted
100644 → 0
+
0
−
50
View file @
4204e9b4
#include
"functions/Format.hpp"
#include
<iostream>
using
ptree
=
boost
::
property_tree
::
ptree
;
std
::
string
remove_line_breaks
(
std
::
string
str
)
{
static
std
::
regex
reg
=
std
::
regex
(
"[-–]
\n
"
);
std
::
string
to
(
""
);
return
std
::
regex_replace
(
str
,
reg
,
to
);
}
std
::
string
remove_page_numbers
(
std
::
string
str
)
// TODO
{
// static std::regex reg = std::regex("[0-9]");
// std::string to("[|]");
// return std::regex_replace(str, reg, to);
return
str
;
}
Format
::
Format
(
ptree
&
config
)
// TODO
{
tasks
.
emplace_back
(
remove_line_breaks
);
// if(config.get<std::string>("function") == "all")
// {
// tasks.emplace_back(remove_line_breaks);
// tasks.emplace_back(remove_page_numbers);
// }
// else
// {
// ;// config.get_child("functions");
// }
// std::string from = config.get<std::string>("from");
// auto flags = std::regex_constants::optimize;
// if(!config.get<bool>("case_sensitive", true))
// flags = flags | std::regex_constants::icase;
// reg = std::regex(from, flags);
}
std
::
string
Format
::
process
(
std
::
string
str
)
{
for
(
auto
&
task
:
tasks
)
{
str
=
task
(
str
);
}
return
str
;
}
This diff is collapsed.
Click to expand it.
functions/Format.hpp
deleted
100644 → 0
+
0
−
19
View file @
4204e9b4
#pragma once
#include
<boost/property_tree/ptree.hpp>
#include
<queue>
#include
<functional>
#include
<regex>
#include
"functions/Function.hpp"
using
ptree
=
boost
::
property_tree
::
ptree
;
class
Format
:
public
Function
{
public:
Format
(
ptree
&
config
);
std
::
string
process
(
std
::
string
str
);
private:
std
::
deque
<
std
::
function
<
std
::
string
(
std
::
string
)
>>
tasks
;
};
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment