ungpt is a cross-platform GUI app that converts ChatGPT's smart punctuation and symbols to plain ASCII.
I often use ChatGPT to correct grammar and spelling errors. It's smarter than a regular spell checker.
However, it frequently outputs text containing "smart" punctuation and typographic Unicode symbols, such as:
- Em dashes (
—) instead of ASCII dashes (-) - Curly quotes (
“ ” ‘ ’) instead of straight quotes (" ') - Ellipses (
…) instead of three dots (...)
Manually fixing these with Find & Replace is tedious. I do it so often that I decided to build a small app to automate the process.
I chose SFML and ImGui because I wanted to cobble something together quickly.
All you have to do is paste text from ChatGPT and copy the clean result.
- Written in modern C++ (C++20).
- Comprehensive documentation with Doxygen-style comments.
- Automatic third-party dependency management using CMake's FetchContent.
- No missing STL headers thanks to header-warden.
This project has been tested on the following systems:
- macOS 15.7 (Sequoia)
Automated testing is also performed on the latest versions of macOS, GNU/Linux, and Windows using GitHub Actions.
Pre-built binaries are available for macOS (ARM64), GNU/Linux (x86_64), and Windows (x86_64). You can download the latest version from the Releases page.
To remove macOS quarantine, use the following commands:
xattr -d com.apple.quarantine ungpt-macos-arm64.app
chmod +x ungpt-macos-arm64.appOn Windows, the OS might complain about the binary being unsigned. You can bypass this by clicking on "More info" and then "Run anyway".
To build and run this project, you'll need:
- C++20 or higher
- CMake
Follow these steps to build the project:
-
Clone the repository:
git clone https://github.com/ryouze/ungpt.git
-
Generate the build system:
cd ungpt mkdir build && cd build cmake ..
The default configuration (
cmake ..) is recommended for most users and is also used by CI/CD to build the project.However, the build configuration can be customized using the following options:
ENABLE_COMPILE_FLAGS(default: ON) - Enables strict compiler warnings and treats warnings as errors. When ON, any code warnings will cause compilation to fail, ensuring clean code. When OFF, warnings are allowed and compilation continues. Disable if you encounter compilation issues due to warnings (although CI should catch such issues).ENABLE_STRIP(default: ON) - Strips debug symbols from Release builds to reduce binary size. When ON, creates smaller executables but removes debugging information. When OFF, keeps full debugging symbols (useful for debugging crashes). Only affects Release builds.ENABLE_LTO(default: ON) - Enables Link Time Optimization for Release builds, producing smaller and faster binaries. When ON, performs cross-module optimizations during linking. When OFF, skips LTO (faster compilation but larger/slower binary). Automatically disabled if compiler doesn't support LTO.ENABLE_CCACHE(default: ON) - Optionally uses ccache to cache compilation results for faster rebuilds. When ON and ccache is installed, dramatically speeds up recompilation. When ON but ccache not installed, silently continues without ccache. When OFF, never uses ccache even if available.BUILD_TESTS(default: OFF) - Builds unit tests alongside the main executable. When ON, creates test binaries that can be run withctest. When OFF, skips test compilation for faster builds. See Testing for usage.
Example command to disable strict compile flags and LTO:
cmake .. -DENABLE_COMPILE_FLAGS=OFF -DENABLE_LTO=OFF
-
Compile the project:
To compile the project, use the following command:
cmake --build . --parallel
After successful compilation, you can run the program using ./ungpt (open ungpt.app on macOS). However, it is highly recommended to install the program, so that it can be run from any directory. Refer to the Install section below.
Tip
The mode is set to Release by default. To build in Debug mode, use cmake .. -DCMAKE_BUILD_TYPE=Debug.
If not already built, follow the steps in the Build section and ensure that you are in the build directory.
To install the program, use the following command:
sudo cmake --install .On macOS, this will install the program to /Applications. You can then run ungpt.app from the Launchpad, Spotlight, or by double-clicking the app in Finder.
- Click Paste to load text from the clipboard.
- Click Normalize to modify the text in place.
- Click Copy to write the text to the clipboard.
To build with runtime sanitizers and keep debugging symbols, use the following configuration in the build directory:
cmake .. \
-DCMAKE_BUILD_TYPE=RelWithDebInfo \
-DENABLE_STRIP=OFF \
-DCMAKE_INTERPROCEDURAL_OPTIMIZATION_RELEASE=OFF \
-DCMAKE_CXX_FLAGS_RELWITHDEBINFO="-fsanitize=address,undefined -fno-omit-frame-pointer" \
-DCMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO="-fsanitize=address,undefined"
cmake --build . --parallelThen, run the program under lldb (macOS):
lldb ./ungpt.app/Contents/MacOS/ungpt
runWhen a sanitizer detects a fault, it will stop execution and print a full stack trace. Use this to pinpoint the root cause of the issue. You can also use lldb commands like bt (backtrace) to inspect the call stack.
The application uses spdlog for logging.
For debug builds, the logging level is set to debug by default, which is very verbose. For non-debug (Release) builds, the logging level is kept at the default info level, which only shows important messages and warnings.
Note
While cmake/External.cmake defines SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_DEBUG in debug builds, this only affects compile-time filtering. The runtime verbosity is controlled by spdlog::set_level(), which is called in main.cpp to enable debug-level messages during execution.
Tests are included in the project but are not built by default.
To enable and build the tests manually, run the following commands from the build directory:
cmake .. -DBUILD_TESTS=ON
cmake --build . --parallel
ctest --verboseLibraries:
- Simple and Fast Multimedia Library - Windowing, graphics, input, etc.
- Dear ImGui - Immediate-mode GUI.
- ImGui-SFML - ImGui-to-SFML binding.
- snitch - Unit-testing framework.
- spdlog - Logging library.
Graphics:
- Spelling Alphabet - Application icon.
All contributions are welcome.
This project is licensed under the MIT License.
