<commit_before>package sms

import (
	"bytes"
	"fmt"
	"io"
	"regexp"

	"github.com/fkgi/teldata"
)

// Address is SMS originator/destination address
type Address struct {
	TON  byte
	NPI  byte
	Addr addrValue
}

type addrValue interface {
	Length() int
	String() string
	Bytes() []byte
}

func (a Address) String() string {
	return fmt.Sprintf(
		"TON/NPI=%d/%d addr=%s", a.TON, a.NPI, a.Addr)
}

// RegexpMatch check matching text of address
func (a Address) RegexpMatch(re *regexp.Regexp) bool {
	return re.MatchString(a.Addr.String())
}

// Encode generate binary data and semi-octet length of this Address
func (a Address) Encode() (l byte, b []byte) {
	switch a.Addr.(type) {
	case teldata.TBCD:
		l = byte(a.Addr.Length())<commit_msg>modify<commit_after>package sms

import (
	"bytes"
	"fmt"
	"io"
	"regexp"

	"github.com/fkgi/teldata"
)

type addrValue interface {
	Length() int
	String() string
	Bytes() []byte
}

// Address is SMS originator/destination address
type Address struct {
	TON  byte
	NPI  byte
	Addr addrValue
}

func (a Address) String() string {
	if a.Addr == nil {
		return "<nil>"
	}
	return fmt.Sprintf(
		"TON/NPI=%d/%d addr=%s", a.TON, a.NPI, a.Addr)
}

// RegexpMatch check matching text of address
func (a Address) RegexpMatch(re *regexp.Regexp) bool {
	return re.MatchString(a.Addr.String())
}

// Encode generate binary data and semi-octet length of this Address
func (a Address) Encode() (l byte, b []byte) {
	switch a.Addr.(type) {
	case teldata.TBCD:
		l = byte(a.Addr.Length())
{'fraction_non_alphanumeric': 0.1394580304031725, 'fraction_numerical': 0.0, 'mean_word_length': 3.821656050955414, 'pattern_counts': {'":': 0, '<': 4, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5542585', 'n_tokens_mistral': 581, 'n_tokens_neox': 567, 'n_words': 166}